l,k=map(int,input().split()) q, mod = divmod(l/2,k) if mod == 0: result = q * k - k else : result = q * k print(int(result))