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