#!/usr/bin/env python3 def solve(a, b): if a == 1 and b == 0: return 1 elif a == -1: return 2 else: return -1 def main(): a, b = (int(z) for z in input().split()) res = solve(a, b) print(res) if __name__ == "__main__": main()