Scanf.scanf "%d %d" (fun n k ->
    let rec loop b acc =
        if b > n then acc else
            let m = n / b in
            let r = n - m * b in
            let acc = acc + m * (b - k) + if k = 0 then max 0 (r - k) else max 0 (r - k + 1) in
            loop (b + 1) acc
    in
    loop (k + 1) 0 |> Printf.printf "%d\n"
)