#include using namespace std; int main(){ int l,k; cin >>l>>k; int tmpL = l; while( tmpL-2*k > 0 ){ tmpL -= 2*k; } cout << (l - tmpL)/2 << endl; return 0; }