l,k=map(int,input().split()) a=l/2 b=a//k #int(a/k) if a<=k: print(0) elif a==b*k: print(int(b-1)*k) else: print(int(b*k))