# -*- coding: utf-8 -*- l,k = map(int,input().split()) if l % (2 * k) == 0: print((int(l / (2 * k)) - 1)* k) else: print(l // (2 * k) * k)