#include int main(){ int n,m; scanf("%d %d",&n,&m); int n2=n/2+n%2; if(n2>m){ printf("-1\n"); }else if(n%2==1&&n>m){ printf("-1\n"); }else{ if(n<=m){ printf("1\n"); }else{ printf("2\n"); } } }