The world famous scientist Innokentiy has just synthesized the potion of immortality. Unfortunately, he put the flask with this potion on the shelf where most dangerous poisons of all time were kept. Now there aren flasks on this shelf, and the scientist has no idea which of them contains the potion of immortality.
Fortunately, Innokentiy has an infinite amount of rabbits. But the scientist doesn't know how exactly these potions affect rabbits. There is the only thing he knows for sure. If rabbit tastes exactlyk potions from the flasks on the shelf, it will survive if there was the immortality potion among them and die otherwise. If rabbit tastes the number of potions different fromk, the result will be absolutely unpredictable, so the scientist won't make such experiments no matter what.
The scientist intends to minimize the amount of lost rabbits while searching for the potion of immortality. You should determine how many rabbits he has to sacrifice in the worst case.
The only line contains two integers separated by space — n and k (1 ≤ n ≤ 2000,1 ≤ k ≤ n) — the number of flasks on the Innokentiy's shelf and the number of potions Innokentiy will give to a single rabbit to taste.
If the scientist cannot determine which flusk contains the potion of immortality, output «-1». Otherwise, output a single integer — the minimal number of rabbits that Innokentiy will sacrifice in the worst case while searching for the potion of immortality.
3 2
1
4 2
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stack>
#include<set>
#include<queue>
#include<vector>
#define MAXN 1010000
#define LL long long
#define ll __int64
#include<iostream>
#include<algorithm>
#define INF 0xfffffff
#define mem(x) memset(x,0,sizeof(x))
#define PI acos(-1)
using namespace std;
LL gcd(LL a,LL b){return b?gcd(b,a%b):a;}
LL lcm(LL a,LL b){return a/gcd(a,b)*b;}
ll powmod(ll a,LL b,ll MOD){ll ans=1;while(b){if(b%2)ans=ans*a%MOD;a=a*a%MOD;b/=2;}return ans;}
//head
int main()
{
int n,k;
while(scanf("%d%d",&n,&k)!=EOF)
{
if(n==1)
printf("0\n");
else if(n==k)
printf("-1\n");
else if(k==1)
printf("%d\n",n-1);
else
{
if(n%k==0||n%k==1)
printf("%d\n",n/k);
else
printf("%d\n",n/k+1);
}
}
return 0;
}