#include<iostream>
using namespace std;
int main(){
int N,K,m;
cin>>N>>K;
m=(N-1)/K;
if((N-1)%K!=0&&m<0){
m=-1;}
cout<<m;
return 0;}
I2luY2x1ZGU8aW9zdHJlYW0+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmludCBtYWluKCl7CmludCBOLEssbTsKY2luPj5OPj5LOwptPShOLTEpL0s7CmlmKChOLTEpJUshPTAmJm08MCl7Cm09LTE7fQpjb3V0PDxtOwpyZXR1cm4gMDt9