//
// Created by Ильдар Ялалов on 14.01.2020.
//
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int inf_int = 1e9 + 100;
const ll inf_ll = 1e18;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double dbl;
typedef unsigned int uint;
#define pb push_back
#define eb emplace_back
const double pi = 3.1415926535898;
#define dout if(debug) cout
#define fi first
#define se second
#define sp setprecision
#define sz(a) (int(a.size()))
#define mp make_pair
#define all(a) a.begin(),a.end()

#ifdef zxc

#include "debug.h"

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

bool debug = 0;
const int MAXN = 4e6 + 100;
const int LOG = 21;
const int mod = 1e9 + 7;
const int MX = (1e7 + 100);


template<uint MD>
struct ModInt {
    using M = ModInt;
    uint v;

    ModInt() : v{0} {}

    ModInt(ll _v) : v{normS(_v % MD + MD)} {}

    explicit operator bool() const { return v != 0; }

    static uint normS(uint x) { return (x < MD) ? x : x - MD; };

    static M make(uint x) {
        M m;
        m.v = x;
        return m;
    }

    static M inv(const M &x) { return x.pow(MD - 2); }

    M operator+(const M &r) const { return make(normS(v + r.v)); }

    M operator-(const M &r) const { return make(normS(v + MD - r.v)); }

    M operator*(const M &r) const { return make(ull(v) * r.v % MD); }

    M operator/(const M &r) const { return *this * inv(r); }

    M &operator+=(const M &r) { return *this = *this + r; }

    M &operator-=(const M &r) { return *this = *this - r; }

    M &operator*=(const M &r) { return *this = *this * r; }

    M &operator/=(const M &r) { return *this = *this / r; }

    M pow(ll n) const {
        M x = *this, r = 1;
        while (n) {
            if (n & 1) r *= x;
            x *= x;
            n >>= 1;
        }
        return r;
    }
};

using Mint = ModInt<mod>;
Mint fac[MAXN];
Mint inv_fac[MAXN];

Mint C(int n, int k) {
    assert(k >= 0 && k <= n);
    return fac[n] * inv_fac[k] * inv_fac[n - k];
}

Mint super_C(int n, int k) {
    return C(k + n - 1, k);
}

Mint dp[2100][2100];
Mint sum[2100][2100];

void solve() {
    fac[0] = 1;
    inv_fac[0] = 1;
    for (int i = 1; i < MAXN; ++i) {
        fac[i] = fac[i - 1] * i;
        inv_fac[i] = Mint::inv(fac[i]);
    }


    int n, k;
    cin >> n >> k;

    if (k == 1) {
        cout << 1;
        return;
    }
    int val = max(n, k) + 1;
    for (int i = n; i >= 1; --i) {
        if (i == n) {
            dp[n][1] = 1;
        } else {
            for (int j = val; j >= 0; --j) {
                sum[i][j] = sum[i][j + 1] + dp[i + 1][j];
            }

            int total = (n - i) * k;

            for (int j = 0; j <= val && j <= total; ++j) {
                dp[i][j + 1] = sum[i][j] * super_C(total - j+1, k - 2);
            }
        }
    }

    Mint ans = 0;
    for (int i = 1; i <= n + 2; ++i) {
        ans += dp[1][i];
    }
    ans = ans * fac[n];
    cout << ans.v << "\n";
}


// CHECK LIMITS (n <= 10^5)
// CHECK CORNER CASES ( n==1)
signed main() {
#ifdef zxc
    freopen("../input.txt", "r", stdin);
//    freopen("../output.txt", "w", stdout);
#else
#endif //zxc
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout.setf(ios::fixed);
    cout.precision(2);

    int t = 1;
    while (t--) {
        solve();
    }
    debug(1.0 * clock() / CLOCKS_PER_SEC);
}

Measured memory_bytes: 65920