Scanf.scanf "%d %d" (fun n m ->
    let rec loop r i acc =
        if r = 1 then acc else
            if i * i > r then 1 :: acc else
                if r mod i <> 0 then loop r (i + 1) acc else
                    let rec loop2 r c =
                        if r mod i = 0 then loop2 (r / i) (c + 1)
                        else loop r (i + 1) (c :: acc)
                    in
                    loop2 r 0
    in
    let mm = 1_000_000_007 in
    let extgcd x y =
        let rec eg r0 r1 a0 a1 b0 b1 =
            if r1 = 0 then a0 else
                let q1 = r0 / r1 in
                eg r1 (r0 mod r1) a1 (a0 - q1 * a1) b1 (b0 - q1 * b1)
        in
        eg x y 1 0 0 1
    in
    let inv x y = (* 1/x in mod y *)
        let c = extgcd x y in
        if c < 0 then c + y else c
    in
    let ( *@) a b = (a * b) mod mm in
    let binomial a b =
        let rec loop i j acc =
            if j > b then acc else
                let acc = acc *@ i *@ inv j mm in
                loop (i - 1) (j + 1) acc
        in
        loop a 1 1
    in
    let l = loop m 2 [] in
    List.fold_left (fun acc v -> acc *@ binomial (v + n - 1) v) 1 l
    |> Printf.printf "%d\n"
)