Comport

Time limit1sMemory limit128 MB

Problem

There is a game board with N fields arranged in a circle. The fields are numbered from 1 to N in clockwise order. Some fields contain obstacles.

Aram starts on field 1 and wants to reach field Z. On every move he always advances exactly K fields clockwise, where K is fixed once before the game starts. (After field N comes field 1 again.)

Except for the starting field 1, none of the fields visited on the way to field Z may contain an obstacle.

For example, if N=13, K=3, and Z=9, then Aram visits the fields in the order 1 → 4 → 7 → 10 → 13 → 3 → 6 → 9. If any field on this route holds an obstacle, that value of K cannot reach the goal.

Given the board, write a program that finds the smallest K with which Aram can travel from field 1 to field Z.

Input

The first line contains the number of fields N (2 ≤ N ≤ 1000), the destination field number Z (2 ≤ Z ≤ N), and the number of obstacles M (0 ≤ M ≤ N-2), separated by spaces.

The second line contains the M field numbers that hold obstacles, as distinct integers. (If M=0 this line is empty.)

Fields 1 and Z never contain an obstacle.

Output

Print, on a single line, the smallest K with which Aram can travel from field 1 to field Z.