#P1592. 互质

互质

Description

Given two positive integers nn and kk, find the kk-th positive integer that is coprime to nn.

Input Format

A single line containing two positive integers nn and kk.

Output Format

A single positive integer, which is the kk-th positive integer that is coprime to nn.

10 5
11

Hint

Constraints

For all testdata, it is guaranteed that 1n1061 \leq n \leq 10^6, 1k1081 \leq k \leq 10^8.

Translated by ChatGPT 5