n, m = map(int, input().split()) if (m < n) or (n == 2) or (m == 2): print(-1) else: print(1)