Sieve of Eratosthenes

No attempts yetTime limit1sMemory limit256 MB

Problem

The sieve of Eratosthenes finds every prime that is not greater than NN. The procedure is this.

  1. Write down every integer from 22 to NN.
  2. Find the smallest number that is not crossed out yet and call it PP. PP is prime.
  3. Cross out PP and every multiple of PP that is not crossed out yet, in increasing order.
  4. If some number is still not crossed out, go back to step 2.

Given NN and KK, find the KK-th number that is crossed out.

Input

The input holds several test cases. Each line has two integers NN and KK separated by a space (2K<N10002 \le K < N \le 1000).

Process every line until the end of the input.

Output

For each test case, print the KK-th number that is crossed out on its own line.