# -*- coding: utf-8 -*- n, m = map(int, input().split()) if n == 2 or n == 4: print(1) else: print(-1)