import math L, K = map(int,input().split()) mm = (L-1)/(K*2) * K print(int(mm))