cho.sh
Notes
Loading...

Find the K-th Divisor

Time limit

1s

Memory limit

128 MB

Problem

For natural numbers p and q, q is a divisor of p if dividing p by q leaves a remainder of 0.

For example, 6 is divisible by 1, 2, 3, and 6, so it has four divisors.

Given two natural numbers N and K, write a program that prints the K-th smallest divisor of N. If the K-th divisor does not exist, print 0.

Input

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

N is between 1 and 10,000 inclusive, and K is between 1 and N inclusive.

Output

Print the K-th smallest divisor of N.

If N has fewer than K divisors, print 0.