using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static long[] NList => ReadLine().Split().Select(long.Parse).ToArray(); public static void Main() { Solve(); } static void Solve() { var c = NList; if (c[0] % 2 == 1) WriteLine(-1); else if (c[0] > c[1] * 2) WriteLine(-1); else if (c[0] <= c[1]) WriteLine(1); else WriteLine(2); } }