a,b=map(int,input().split()) c=2*b count=a//c if a==c: print(0) if a==count*c: print((count*c)-1) else: print(count*c)