# -*- coding: utf-8 -*- n, m = map(int, input().split()) if n < m: print(1) elif n % 2 == 0 and 2/n <= m: print(2) else: print(-1)