lis = list(map(int,input().split())) if(lis[0]%lis[1] == 0 and lis[0]/lis[1] == (1 or 2)): print(0) else: print(int((lis[0]/2)//lis[1]*lis[1]))