题目描述
Problem Description
The Sieve of Eratosthenes is a famous algorithm for finding all prime numbers up to $n$. The steps of the algorithm are:
1. Write down all integers from $2$ to $n$ (inclusive).
2. Find the smallest number that has not been deleted and name it $p$; $p$ is a prime number.
3. Cross out $p$ and all its multiples that have not been crossed out yet.
4. If there are still numbers that have not been crossed out, go to step 2.
Write a program that, given $n$ and $k$, finds the $k$-th integer to be deleted.
Input Format
A single line containing two integers $n$ and $k$, as described in the problem statement.
Output Format
A single line containing one integer, representing the $k$-th integer that is crossed out.
Sample Input and Output
Sample Input #1
7 3
Sample Output #1
6
Sample Input #2
15 12
Sample Output #2
7
Sample Input #3
10 7
Sample Output #3
9
Notes
Data Size and Constraints
For $100\%$ of the data, $2 \leq k < n \leq 1000$.
Translation
This problem is translated from COCI2008-2009 CONTEST #2 RESETO, translated by @mnesia.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分