#include using namespace std; long long a,b,x,y,mx,aux,i,j; long long cmmdc(long long a,long long b) { long long r=1; while(r!=0) { r=a%b; a=b; b=r; } return a; } int main() { cin>>a>>b; x=a; while (cmmdc(x,b)!=1 && x<=b) x++; y=b; while (cmmdc(y,b)!=1 && y>=a) y--; mx=max(b-x+1,y-a+1); if (mx<=0) { cout<<-1; return 0; } if (x>y) { aux=x; x=y; y=aux; } for (i=a;i<=x;i++) for (j=i+mx;j<=b;j++) { if (cmmdc(i,j)==1 && j-i+1>mx) mx=j-i+1; } cout<