P1592 Coprime

Description

Given two positive integers $n$ and $k$, find the $k$-th positive integer that is coprime to $n$.

Input Format

A single line containing two positive integers $n$ and $k$.

Output Format

A single positive integer, which is the $k$-th positive integer that is coprime to $n$.

Explanation/Hint

Constraints For all testdata, it is guaranteed that $1 \leq n \leq 10^6$, $1 \leq k \leq 10^8$. Translated by ChatGPT 5