#P1592. K-th Coprime Integer

    ID: 14878 Type: Default 1000ms 256MiB

K-th Coprime Integer

K-th Coprime Integer

Given two positive integers (n) and (k), find the (k)th positive integer that is coprime with (n).

Two integers are coprime if their greatest common divisor (\gcd(n, x) = 1).

inputFormat

The input consists of two space-separated positive integers (n) and (k) on a single line.

outputFormat

Output the (k)th positive integer that is coprime with (n).

sample

6 1
1