var n,e,m,ans,t,i:longint;
f:boolean;
a,u:array[1..10000]of boolean;
begin
readln(n,e,m);
fillchar(a,sizeof(a),true);
for i:=1 to m do begin
read(t);
a[t]:=false;
end;
for ans:=1 to n do begin
i:=1;
f:=true;
fillchar(u,sizeof(u),false);
while i<>e do begin
u[i]:=true;
if i=n then i:=1
else begin inc(i,ans);
if i>n then i:=i-n
end;
if u[i] then begin f:=false; break end;
if a[i]=false then begin f:=false; break; end;
end;
if f then begin writeln(ans);
close(input);
close(output);
halt; end;
end;
writeln('-1');
close(input);
close(output);
end.