https://codeforces.com/problemset/problem/476/A
`#include<iostream>
#include<cmath>
using namespace std;
int main(){
int n,m;
cin >> n >>m;
for(int i=1;i<=n/m;i++){
int q=im;
int h=n-q;
int k=n-(2h);
if(k>=0 && h>=0 && !(k==0 && h==0)){
cout << q;
return 0;
}
}
cout << -1;
return 0;
}
`