#include using ll = long long; using namespace std; int main() { ll l,k; scanf("%lld", &l); scanf("%lld", &k); ll k2=k<<1; l = ((l+k2-1)/k2)*k2; printf("%lld\n",l/2-k); return 0; }