L, K= map(int, raw_input().split()) i = 0 while i * K * 2 < L: i += 1 print (i -1) * K