# -*- coding: utf-8 -*- # https://yukicoder.me/problems/134 def main(): l, k = map(int, input().split()) n = 2 * k # 一回のかじりで減る量 m = l // n if l % n != 0 else l // n - 1 print(m * k) if __name__ == '__main__': main()