let () = Printf.printf "%d\n" @@ Scanf.scanf "%d %d" (fun n k ->
  Array.init n (( + ) 1)
  |> Array.map (fun b ->
      max 0 (b - k) * (n / b)
    + min (n mod b) (max 0 (n mod b - k + 1)))
  |> Array.fold_left ( + ) 0)