Very easy

Execution time limit is 1 second

Runtime memory usage limit is 64 megabytes

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.

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.

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.

Input #1

Answer #1

Input #4

Answer #4