#include int main(void){ int n; // number of animals int m; // number of ships scanf("%d %d",&n,&m); if(n <= m){ printf("1\n"); }else{ if(n % 2 == 0 && m >= n/2 + n%2){ printf("2\n"); }else{ printf("-1\n"); } } return 0; }