#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const ll p = 1e9+7;
const int M = 2005;

ll fact[M*M], invfact[M*M], inv[M*M], dp[M][M], part[M][M], n, k;

ll comb(int x, int y) {
	if (x < 0 || y < 0 || x < y)
		return 0;
	return fact[x]*invfact[y]%p*invfact[x-y]%p;
}

int main() {
	cin >> n >> k;
	if (k == 1) {
		cout << "1\n"; return 0;
	}
	inv[1] = fact[0] = fact[1] = invfact[0] = invfact[1] = 1;
	for (int i = 2; i < M*M; ++i) {
		inv[i] = (p - (p/i) * inv[p%i] % p) % p;
		fact[i] = i*fact[i-1]%p;
		invfact[i] = inv[i]*invfact[i-1]%p;
	}

	for (int i = 1; i <= n; ++i) {
		// casework on longest prefix of 0s
		if (i == 1)
			dp[i][1] = 1;
		else
			for (int j = 1; j <= i; ++j)
				dp[i][j] = comb(i*k-j-1, k-2)*i%p*part[i-1][j-1]%p;
		
		for (int j = i; j >= 0; --j)
			part[i][j] = (part[i][j+1]+dp[i][j])%p;
	}

	cout << part[n][0] << endl;
}
