Sieve of Eratosthenes

Time limit1sMemory limit128 MB

Problem

The Sieve of Eratosthenes is a classic algorithm for finding every prime number not greater than (N). In this problem, you must follow the exact order in which numbers are removed from the sieve.

The algorithm works as follows.

  1. Write down every integer from 2 through (N).
  2. Find the smallest number that has not been removed yet. Call it (P); this number is prime.
  3. Remove (P), then remove every still-unremoved multiple of (P) in increasing order.
  4. If any number remains unremoved, return to step 2.

Given (N) and (K), determine the number removed on the (K)-th removal.

Input

The first line contains two integers (N) and (K). (1 \le K < N \le 1000)

Output

Print the number that is removed on the (K)-th removal.