#include using namespace std; int main() { int n,m; cin >> n >> m; if(n%m==0 || n%m >= 3) { cout << n/m << endl; } else { cout << -1 << endl; } return 0; }