#include typedef long long ll; #define INF 1000000000 #define MOD 1000000007 using namespace std; int main(void){ int n,m,ans; cin>>n>>m; if(n<=m){ ans=1; }else if(m==2){ if(n==3){ ans=-1; }else{ ans=(n+1)/2; } }else{ ans=n/m+(n-n/m*m)/m; } cout<