Scanf.scanf "%d %d" (fun n k ->
    let m = 1_000_000_000 + 7 in
    let ( +@) a b = (a + b) mod m in
    let ( -@) a b = (((a - b) mod m) + m) mod m in
    let ( *@) a b = (a * b) mod m in
    let pow_mod a n =
        let rec loop r i acc =
            if i = 0 then acc else
            let acc = if i land 1 = 1 then acc *@ r else acc in
            loop (r *@ r) (i lsr 1) acc
        in
        loop a n 1
    in
    let a = Array.make (k + 1) 0 in
    for i = k downto 1 do
        let rec loop c acc =
            if c > k then acc else loop (c + i) (acc -@ a.(c))
        in
        let r = loop (i + i) (pow_mod (k / i) n) in
        a.(i) <- r
    done;
    let rec loop i acc =
        if i > k then acc else loop (i + 1) (acc +@ i *@ a.(i))
    in
    loop 1 0 |> Printf.printf "%d\n"
)