#include <bits/stdc++.h>
using namespace std;
bool sortinrev(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.first > b.first);
}
long long sumofdigits(long long x) {
  int s = 0;
  while (x != 0) {
    s += x % 10;
    x = x / 10;
  }
  return s;
}
int checkDiffDigits(string str) {
  for (int i = 0; i < str.size(); i++) {
    for (int j = i + 1; j < str.size(); j++) {
      if (str[i] == str[j]) {
        return false;
        break;
      }
    }
  }
  return true;
}
bool isPowerOfTwo(long long x) { return x && (!(x & (x - 1))); }
long long digitNO(long long num) { return floor(log10(num)) + 1; }
string converttostring(long long n) {
  string s;
  stringstream ss;
  ss << n;
  s = ss.str();
  return s;
}
long long reversedigits(long long number) {
  long long reverse = 0;
  long long rem;
  while (number != 0) {
    rem = number % 10;
    reverse = reverse * 10 + rem;
    number /= 10;
  }
  return reverse;
}
vector<long long> prime;
bool sieve[1000000];
void primeseive(int n) {
  sieve[0] = sieve[1] = 1;
  prime.push_back(2);
  for (long long i = 4; i <= n; i += 2) {
    sieve[i] = 1;
  }
  long long sqrtn = sqrt(n);
  for (long long i = 3; i <= sqrtn; i += 2) {
    if (sieve[i] == 0) {
      for (long long j = i * i; j <= n; j += 2 * i) {
        sieve[j] = 1;
      }
    }
  }
  for (long long i = 3; i <= n; i += 2) {
    if (sieve[i] == 0) prime.push_back(i);
  }
}
vector<long long> primeFactors;
void primeFactorize(long long n) {
  long long sqrtn = sqrt(n);
  for (long long i = 0; i < prime.size() && prime[i] <= sqrtn; i++) {
    if (sieve[n] == 0) break;
    if (n % prime[i] == 0) {
      while (n % prime[i] == 0) {
        n /= prime[i];
        primeFactors.push_back(prime[i]);
      }
      sqrtn = sqrt(n);
    }
  }
  if (n != 1) primeFactors.push_back(n);
}
long long __gcd(long long n1, long long n2) {
  while (n1 != n2) {
    if (n1 > n2)
      n1 -= n2;
    else
      n2 -= n1;
  }
  return n1;
}
long long LCM(long long n1, long long n2) {
  long long max = (n1 > n2) ? n1 : n2;
  do {
    if (max % n1 == 0 && max % n2 == 0) {
      return max;
    } else
      ++max;
  } while (true);
}
void BFS(long long int destination, vector<long long int> adj[]) {
  queue<long long int> q;
  long long int isVisited[100000] = {0};
  long long int s = 1;
  long long int level = 1;
  isVisited[s] = 1;
  q.push(adj[s][0]);
  while (!q.empty()) {
    s = q.front();
    if (s == 0) {
      level++;
      q.pop();
      continue;
    }
    if (s == destination) {
      cout << endl << level;
      return;
    }
    q.pop();
    for (auto it = adj[s].begin(); it != adj[s].end(); ++it) {
      if (!isVisited[*it]) {
        isVisited[*it] = 1;
        q.push(*it);
      }
    }
    q.push(0);
  }
}
int reversenum(int n) {
  int reverse = 0, rem = 0;
  while (n != 0) {
    rem = n % 10;
    reverse = reverse * 10 + rem;
    n /= 10;
  }
  return reverse;
}
int euphi(int n) {
  int res = n;
  int sqrtn = sqrt(n);
  for (int i = 0; i < prime.size() && prime[i] <= sqrtn; i++) {
    if (n % prime[i] == 0) {
      while (n % prime[i] == 0) {
        n /= prime[i];
      }
      sqrtn = sqrt(n);
      res /= prime[i];
      res *= prime[i] - 1;
    }
  }
}
int main() {
  clock_t tStart = clock();
  int n, m;
  cin >> n >> m;
  if (n >= m) {
    int z = (n / 2) + (n % 2);
    while (true) {
      if (z % m == 0) {
        cout << z;
        break;
      } else
        z++;
    }
  } else
    cout << -1;
}

### Prompt

Develop a solution in CPP to the problem described below:

Dreamoon wants to climb up a stair of n steps. He can climb 1 or 2 steps at each move. Dreamoon wants the number of moves to be a multiple of an integer m. 

What is the minimal number of moves making him climb to the top of the stairs that satisfies his condition?

Input

The single line contains two space separated integers n, m (0 < n ≤ 10000, 1 < m ≤ 10).

Output

Print a single integer — the minimal number of moves being a multiple of m. If there is no way he can climb satisfying condition print  - 1 instead.

Examples

Input

10 2


Output

6


Input

3 5


Output

-1

Note

For the first sample, Dreamoon could climb in 6 moves with following sequence of steps: {2, 2, 2, 2, 1, 1}.

For the second sample, there are only three valid sequence of steps {2, 1}, {1, 2}, {1, 1, 1} with 2, 2, and 3 steps respectively. All these numbers are not multiples of 5.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
bool sortinrev(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.first > b.first);
}
long long sumofdigits(long long x) {
  int s = 0;
  while (x != 0) {
    s += x % 10;
    x = x / 10;
  }
  return s;
}
int checkDiffDigits(string str) {
  for (int i = 0; i < str.size(); i++) {
    for (int j = i + 1; j < str.size(); j++) {
      if (str[i] == str[j]) {
        return false;
        break;
      }
    }
  }
  return true;
}
bool isPowerOfTwo(long long x) { return x && (!(x & (x - 1))); }
long long digitNO(long long num) { return floor(log10(num)) + 1; }
string converttostring(long long n) {
  string s;
  stringstream ss;
  ss << n;
  s = ss.str();
  return s;
}
long long reversedigits(long long number) {
  long long reverse = 0;
  long long rem;
  while (number != 0) {
    rem = number % 10;
    reverse = reverse * 10 + rem;
    number /= 10;
  }
  return reverse;
}
vector<long long> prime;
bool sieve[1000000];
void primeseive(int n) {
  sieve[0] = sieve[1] = 1;
  prime.push_back(2);
  for (long long i = 4; i <= n; i += 2) {
    sieve[i] = 1;
  }
  long long sqrtn = sqrt(n);
  for (long long i = 3; i <= sqrtn; i += 2) {
    if (sieve[i] == 0) {
      for (long long j = i * i; j <= n; j += 2 * i) {
        sieve[j] = 1;
      }
    }
  }
  for (long long i = 3; i <= n; i += 2) {
    if (sieve[i] == 0) prime.push_back(i);
  }
}
vector<long long> primeFactors;
void primeFactorize(long long n) {
  long long sqrtn = sqrt(n);
  for (long long i = 0; i < prime.size() && prime[i] <= sqrtn; i++) {
    if (sieve[n] == 0) break;
    if (n % prime[i] == 0) {
      while (n % prime[i] == 0) {
        n /= prime[i];
        primeFactors.push_back(prime[i]);
      }
      sqrtn = sqrt(n);
    }
  }
  if (n != 1) primeFactors.push_back(n);
}
long long __gcd(long long n1, long long n2) {
  while (n1 != n2) {
    if (n1 > n2)
      n1 -= n2;
    else
      n2 -= n1;
  }
  return n1;
}
long long LCM(long long n1, long long n2) {
  long long max = (n1 > n2) ? n1 : n2;
  do {
    if (max % n1 == 0 && max % n2 == 0) {
      return max;
    } else
      ++max;
  } while (true);
}
void BFS(long long int destination, vector<long long int> adj[]) {
  queue<long long int> q;
  long long int isVisited[100000] = {0};
  long long int s = 1;
  long long int level = 1;
  isVisited[s] = 1;
  q.push(adj[s][0]);
  while (!q.empty()) {
    s = q.front();
    if (s == 0) {
      level++;
      q.pop();
      continue;
    }
    if (s == destination) {
      cout << endl << level;
      return;
    }
    q.pop();
    for (auto it = adj[s].begin(); it != adj[s].end(); ++it) {
      if (!isVisited[*it]) {
        isVisited[*it] = 1;
        q.push(*it);
      }
    }
    q.push(0);
  }
}
int reversenum(int n) {
  int reverse = 0, rem = 0;
  while (n != 0) {
    rem = n % 10;
    reverse = reverse * 10 + rem;
    n /= 10;
  }
  return reverse;
}
int euphi(int n) {
  int res = n;
  int sqrtn = sqrt(n);
  for (int i = 0; i < prime.size() && prime[i] <= sqrtn; i++) {
    if (n % prime[i] == 0) {
      while (n % prime[i] == 0) {
        n /= prime[i];
      }
      sqrtn = sqrt(n);
      res /= prime[i];
      res *= prime[i] - 1;
    }
  }
}
int main() {
  clock_t tStart = clock();
  int n, m;
  cin >> n >> m;
  if (n >= m) {
    int z = (n / 2) + (n % 2);
    while (true) {
      if (z % m == 0) {
        cout << z;
        break;
      } else
        z++;
    }
  } else
    cout << -1;
}

```