L, K = map(int, input().split()) mm = L/K/2 if mm == 1: print(0) elif K == 1: print(int(mm)*K-K) else: print(int(mm)*K)