#include using namespace std; #define REP(i,N) for(i=0;i P; typedef struct{ int first; int second; int third; }T; //昇順 bool comp_Se(T& l, T& r){ return l.second < r.second; } int main(void){ ll L,K,ans=0,mod; cin >> L >> K; if(mod=L%(2*K)) ans=(L-mod)/2; else ans=max((ll)0,(L-mod-2*K)/2); cout << ans << endl; return 0; }