#include int main() { long long int a, b; scanf("%lld %lld", &a, &b); int n = 0; n = a * n + b; if (n == 0) printf("1\n"); else { n = a * n + b; if (n == 0) printf("2\n"); else printf("-1\n"); } return 0; }