#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
inline int power(int a, int b) {
    long long res = a, ans = 1;
    for (; b; b >>= 1, res = res * res % mod) if (b & 1) ans = ans * res % mod;
    return ans;
}
int n, k, m, a[25010];
int buc[410];
int dp[2][25010][410];
#define dp1 dp[0]
#define dp2 dp[1]
int main() {
    scanf("%d%d%d", &n, &k, &m);
    int llen = 0, rlen = 0;
    set < int > s;
    for (int i = 1; i <= m; i++) scanf("%d", a + i);
    if (m >= k) {
        int now = 0;
        for (int i = 1; i <= k; i++) {
            if (!buc[a[i]]++) now++;
        }
        if (now == k) return cout << 1ll * power(k, n - m) * (n - m + 1) % mod << endl, 0;
        for (int i = k + 1; i <= m; i++) {
            if (!buc[a[i]]++) now++;
            if (!--buc[a[i - k]]) now--;
            if (now == k) return cout << 1ll * power(k, n - m) * (n - m + 1) % mod << endl, 0;
        }
    }
    while (llen != m && !s.count(a[llen + 1])) s.insert(a[++llen]);
    s.clear();
    while (rlen != m && !s.count(a[m - rlen])) s.insert(a[m - rlen++]);
    if (llen == m) {
        dp1[1][1] = k;
        for (int i = 1; i < n; i++) {
            for (int j = k - 1; j > 0; j--) {
                dp1[i + 1][j] = (dp1[i + 1][j + 1] + dp1[i][j]) % mod;
            }
            for (int j = 1; j < k - 1; j++) dp1[i + 1][j + 1] = (dp1[i + 1][j + 1] + 1ll * dp1[i][j] * (k - j)) % mod;
        }
        for (int i = 1; i < k; i++) dp2[n][i] = 1;
        for (int i = n; i --> 0; ) {
            for (int j = 1; j < k; j++) dp2[i][j] = (dp2[i][j - 1] + dp2[i + 1][j]) % mod;
            for (int j = 1; j < k - 1; j++) dp2[i][j] = (1ll * dp2[i + 1][j + 1] * (k - j) + dp2[i][j]) % mod;
        }
        int ans = 0;
        for (int i = 1; i <= n; i++) {
            for (int j = m; j < k; j++) {
                ans = (ans + 1ll * dp1[i][j] * dp2[i][j]) % mod;
            }
        }
        for (int i = k; i > k - m; i--) ans = 1ll * ans * power(i, mod - 2) % mod;
        return cout << (mod - ans + 1ll * power(k, n - m) * (n - m + 1)) % mod << endl, 0;
    }
    else {
        for (int t = 0; t < 2; t++) {
            dp[t][0][t ? llen : rlen] = 1;
            for (int i = 0; i < n; i++) {
                for (int j = k - 1; j > 0; j--) {
                    dp[t][i + 1][j] = (dp[t][i + 1][j + 1] + dp[t][i][j]) % mod;
                }
                for (int j = 1; j < k - 1; j++) dp[t][i + 1][j + 1] = (dp[t][i + 1][j + 1] + 1ll * dp[t][i][j] * (k - j)) % mod;
            }
        }
        int ans = 0;
        for (int i = 0; i <= n - m; i++) {
            int sum1 = 0, sum2 = 0;
            for (int j = 1; j < k; j++) sum1 = (sum1 + dp[0][i][j]) % mod;
            for (int j = 1; j < k; j++) sum2 = (sum2 + dp[1][n - m - i][j]) % mod;
            ans = (ans + 1ll * sum1 * sum2) % mod;
        }
        return cout << (mod - ans + 1ll * power(k, n - m) * (n - m + 1)) % mod << endl, 0;
    }
}