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