#include <bits/stdc++.h>   using namespace std;   int main() {     int z, n, m;     while (cin >> n >> m) {       if (m > n)         z = -1;       else {         if (n % 2 == 0)           z = n / 2;         else           z = (n / 2) + 1;         while (z % m != 0) {           z++;         }       }       cout << z;     }     return 0;   }   