favorite We need a little bit of your help to keep things running, click on this banner to learn more
Problems

# Rabbit-failure

On the stop we have N passengers, which Vanja and Peter were among, called at a trolleybus. The Vanja purchased a ticket the first. Peter glanced on the ticket and saw that the number of ticket is a prime number, and decided, that he must purchase a ticket with a simple number. Whether there is a chance at Peter to purchase a ticket to a next stop, if at a conductor only one roll of tickets, in the numbers of tickets is determined the amount by the bought ticket. In case if a roll is closed, Peter will stow "away", and he is expected by a failure.

#### Input

An entrance line contains two numbers: amount of passengers and number of trolleybus ticket. The amount of numbers in the number of ticket does not exceed 6.

#### Output

Show out the amount of passengers, which it is necessary to skip Peter, to purchase a ticket with a simple number, or –1, if doing it is impossible.

Time limit 1 second
Memory limit 64 MiB
Input example #1
5 011

Output example #1
1

Input example #4
6 23

Output example #4
-1