#define NDEBUG
NDEBUG


#include <algorithm>
#include <cassert>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <memory>
#include <random>


typedef int64_t int64;


using namespace std;

/// caide keep
bool __hack = std::ios::sync_with_stdio(false);
/// caide keep
auto __hack1 = cin.tie(nullptr);


namespace template_util {
    

    constexpr int bytecount(uint64_t x) {
        return x ? 1 + bytecount(x >> 8) : 0;
    }

    /// caide keep
    template<int N>
    struct bytetype {
        
    };

    /// caide keep
    template<>
    struct bytetype<4> {
        
    };

    /// caide keep
    template<>
    struct bytetype<3> {
        
    };

    /// caide keep
    template<>
    struct bytetype<2> {
        
    };

    /// caide keep
    template<>
    struct bytetype<1> {
        
    };

    /// caide keep
    template<>
    struct bytetype<0> {
        
    };

    /// caide keep
    template<uint64_t N>
    struct minimal_uint : bytetype<bytecount(N)> {
    };
}


template<class T>
T next(istream& in) {
    T ret;
    in >> ret;
    return ret;
}


const int MOD = (int)1e9 + 7;
const int MAXN = 2003;
const int MAX = 2003 * 2003;

vector<int64> getFactorials(int n, int64 MOD) {
    vector<int64> res(n);
    res[0] = res[1] = 1;
    for (int i = 2; i < n; ++i) {
        res[i] = (res[i-1] * i) % MOD;
    }
    return res;
}

vector<int64> getRevs(int n, int64 MOD) {
    vector<int64> res(n, 0);
    if (n > 1) {
        res[1] = 1;
    }
    for (int i = 2; i < n; ++i) {
        res[i] = (MOD - MOD / i * res[((int) (MOD % i))] % MOD) % MOD;
    }
    return res;
}

vector<int64> getReverseFactorials(int n, int64 MOD) {
    vector<int64> revs = getRevs(n, MOD);
    vector<int64> res(n);
    res[0] = res[1] = 1;
    for (int i = 2; i < n; ++i) {
        res[i] = (res[i-1] * revs[i]) % MOD;
    }
    return res;
}

vector<int64> factorials, r_factorials;

int64 getC(int n, int k) {
    int64 res = factorials[n];
    res *= r_factorials[n - k];
    if (res >= MOD) {
        res %= MOD;
    }
    res *= r_factorials[k];
    if (res >= MOD) {
        res %= MOD;
    }
    return res;
}

int dp[MAXN][MAXN];
int n, k;

void add(int& a, int b) {
    a += b;
    if (a >= MOD) {
        a -= MOD;
    }
}

int rec(int x, int y) {
    if (x == 0 && y == 0) {
        return 1;
    }
    if (y < x) {
        return 0;
    }
    int& ret = dp[x][y];
    if (ret != -1) return ret;
    ret = 0;

    if (x != 0) {
        add(ret, rec(x - 1, y));
    }
    if (y > x) {
        int64 cc = getC(x + y * (k - 1) - 1, k - 2);
        int64 r = (cc * rec(x, y - 1)) % MOD;
        add(ret, (int)r);
    }
    return ret;
}

void solve(istream& in, ostream& out) {
    factorials = getFactorials(MAX, MOD);
    r_factorials = getReverseFactorials(MAX, MOD);
    n = next<int>(in);
    k = next<int>(in);
    if (k == 1) {
        out << 1 << endl;
        return;
    }
    memset(dp, -1, sizeof dp);
    out << (rec(n, n) * factorials[n]) % MOD << endl;
}


int main() {
    solve(cin, cout);
    return 0;
}



Measured memory_bytes: 94336