cho.sh
Notes
Loading...

Find a Fraction

Time limit

2s

Memory limit

128 MB

Problem

Sort every reduced fraction p/q with denominator at most N in increasing order of value. Each fraction must satisfy 1 <= p < q <= N.

Find the Kth fraction in this sorted list.

Input

The first line contains two natural numbers N and K, separated by a space.

1 <= N <= 40,000, and K does not exceed the total number of reduced fractions whose denominator is at most N.

Output

If the Kth fraction is p/q, print p and q separated by a space. The two numbers p and q must be coprime.