# coding: utf-8 # Your code here! l,k = map(int,input().split()) yuu_num = l // ( k * 2) if l % (2 * k) == 0: yuu_num -= 1 ans = yuu_num * k print(ans)