The Ticket Chase#14

The Ticket Chase

1 second
64 megabytes
Very easy (≈850)

At a trolleybus stop, passengers, including Petryk and Ivanko, board the trolleybus. Petryk buys the first ticket, whose number is a prime. Ivanko notices this and decides he also wants to get a ticket with a prime number. Tickets are issued sequentially, starting from Petryk's ticket number, and there is only one roll of consecutively numbered tickets for all passengers.

Input

The input contains two numbers: — the number of passengers, and the ticket number on Petryk's ticket. The ticket number contains at most digits.

Output

Output the number of passengers Ivanko must let go ahead of him to obtain a ticket with a prime number. If it is impossible for Ivanko to get such a ticket before the tickets run out, output .

Examples

Example 1

Loading
Loading

Example 4

Loading
Loading