#include using namespace std; int main() { long long A, B; cin >> A >> B; int ans = -1; if( B == 0 ) ans = 1; else if( A == -1 ) ans = 2; cout << ans << endl; }