l, k = gets.chomp!.split(' ').map(&:to_i) def pocky(l, k, n) if l <= 2 * n * k 0 else 2 * k + pocky(l, k, n + 1) end end puts pocky(l, k, 1) - k