let modulo = 1000000007

let ( +% ) a b = let c = a + b in if c > modulo then c - modulo else c
let ( -% ) a b = if a >= b then a - b else modulo + a - b
let ( *% ) a b = a * b mod modulo

let pow k =
  let rec aux accu k = function
  | 0 -> accu
  | n when n mod 2 = 0 -> aux accu (k *% k) (n/2)
  | n -> aux (accu *% k) (k *% k) (n/2) in
  aux 1 k

let inv k = pow k (modulo-2)

let n, k = Scanf.scanf "%d %d" (fun x y -> x, y)

let () = if k = 1 then begin print_int 1; exit 0 end

let smax = n * k
let factbl = Array.make (smax+1) 1
let ifactbl = Array.make (smax+1) 0
let () = for i = 1 to smax do factbl.(i) <- factbl.(i-1) *% i done;
         ifactbl.(smax) <- inv factbl.(smax);
         for i = smax-1 downto 0 do ifactbl.(i) <- ifactbl.(i+1) *% (i+1) done

let binom n k = factbl.(n) *% ifactbl.(k) *% ifactbl.(n-k)


let dp = Array.make (n+1) 0

let () = dp.(0) <- 1;
         for i = 0 to n-1 do for j = i+1 to n do
           dp.(j) <- dp.(j) +% dp.(j-1) *% binom (i+j*(k-1)-1) (k-2) done done;
         print_int (factbl.(n) *% dp.(n))