EasyRating 1000
Steps in a Multiple
Climb n stairs taking 1 or 2 steps at a time. The number of moves must be a multiple of m. Print the fewest moves, or -1 if impossible.
Input
Two integers n (1 ≤ n ≤ 10⁴) and m (1 < m ≤ 10).
Output
One integer.
Sample 1
Input
10 2
Output
6
Sample 2
Input
3 5
Output
-1
Output appears here