l,k = map(int,input().split()) if l % 2*k == 0: print(int(l/(2*k)) * k - 1) elif 2*k < l: print(int(l/(2*k)) * k) elif 2*k >= l: print(0)