const int N = 25010;
const int LG = 21;
const int MOD = 1e9 + 7;
const int INF = 1e9;

#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <time.h>
#include <unordered_set>
#include <bitset>
#include <deque>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vi;

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second
#define re return

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

ll inq(ll x, ll y)
{
    if (!y) re 1 % MOD;
    ll l = inq(x, y / 2);
    if (y % 2) re l * l % MOD * x % MOD;
    re l * l % MOD;
}

ll rev(ll x)
{
    return inq(x, MOD - 2);
}

bool __precomputed_combinatorics = 0;
vector<ll> __fact, __ufact, __rev;

void __precompute_combinatorics()
{
    __precomputed_combinatorics = 1;
    __fact.resize(N);
    __ufact.resize(N);
    __rev.resize(N);
    __rev[1] = 1;
    for (int i = 2; i < N; i++) __rev[i] = MOD - __rev[MOD % i] * (MOD / i) % MOD;
    __fact[0] = 1, __ufact[0] = 1;
    for (int i = 1; i < N; i++) __fact[i] = __fact[i - 1] * i % MOD, __ufact[i] = __ufact[i - 1] * __rev[i] % MOD;
}

ll fact(int x)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[x];
}

ll cnk(int n, int k)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[n] * __ufact[n - k] % MOD * __ufact[k] % MOD;
}

const int K = 450;

int n, m, k;
int a[N];
ll val;
ll dp[2][N][K];

signed main()
{
    srand(time(NULL));
    #ifdef ONLINE_JUDGE
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
    #endif // ONLINE_JUDGE
    cin >> n >> k >> m;
    if (k > n) cout << 0, exit(0);
    for (int i = 0; i < m; i++) cin >> a[i], a[i]--;
    val = (n - m + 1) * inq(k, n - m) % MOD;
    for (int i = 0; i + k - 1 < m; i++)
    {
        vector<int> cnt(k);
        for (int j = 0; j < k; j++)
        {
            cnt[a[i + j]]++;
        }
        int t = 1;
        for (int j = 0; j < k; j++)
        {
            if (cnt[j] != 1) t = 0;
        }
        if (t)
        {
            cout << val;
            return 0;
        }
    }
    int same = 0;
    if (m > k) same = 1;
    else for (int i = 0; i < m; i++) for (int j = i + 1; j < m; j++) if (a[i] == a[j]) same = 1;
    if (same == 0)
    {
        dp[0][0][0] = 1;
        for (int i = 1; i <= n; i++)
        {
            ll si0 = 0, si1 = 0;
            for (int b = k - 1; b >= 1; b--)
            {
                si0 = (si0 + dp[0][i - 1][b]) % MOD;
                si1 = (si1 + dp[1][i - 1][b]) % MOD;
                for (int a = b; a <= b; a++)
                {
                    dp[0][i][b] = (dp[0][i][b] + si0) % MOD;
                    dp[1][i][b] = (dp[1][i][b] + si1) % MOD;
                }
            }
            for (int b = 1; b < k; b++)
            {
                dp[0][i][b] = (dp[0][i][b] + (k - b + 1) * dp[0][i - 1][b - 1]) % MOD;
                dp[1][i][b] = (dp[1][i][b] + (k - b + 1) * dp[1][i - 1][b - 1]) % MOD;
            }
            for (int a = m; a < k; a++)
            {
                dp[1][i][a] = (dp[1][i][a] + dp[0][i][a]) % MOD;
            }
        }
        ll si = 0;
        for (int i = 1; i < k; i++)
        {
            si += dp[1][n][i];
        }
        si %= MOD;
        si = si * fact(k - m) % MOD * rev(fact(k)) % MOD;
        cout << (val + MOD - si) % MOD << "\n";
        return 0;
    }
    else
    {
        dp[0][0][0] = 1;
        for (int i = 1; i <= n; i++)
        {
            ll si0 = 0, si1 = 0;
            for (int b = k - 1; b >= 1; b--)
            {
                si0 = (si0 + dp[0][i - 1][b]) % MOD;
                si1 = (si1 + dp[1][i - 1][b]) % MOD;
                for (int a = b; a <= b; a++)
                {
                    dp[0][i][b] = (dp[0][i][b] + si0) % MOD;
                    dp[1][i][b] = (dp[1][i][b] + si1) % MOD;
                }
            }
            for (int b = 1; b < k; b++)
            {
                dp[0][i][b] = (dp[0][i][b] + (k - b + 1) * dp[0][i - 1][b - 1]) % MOD;
                dp[1][i][b] = (dp[1][i][b] + (k - b + 1) * dp[1][i - 1][b - 1]) % MOD;
            }
            for (int a = m; a < k; a++)
            {
                dp[1][i][a] = (dp[1][i][a] + dp[0][i][a]) % MOD;
            }
        }
        ll si = 0;
        vector<int> cnt(k);
        ll F = 0, B = 0;
        for (int i = 0; i < m; i++)
        {
            cnt[a[i]]++;
            if (cnt[a[i]] > 1) break;
            F++;
        }
        fill(all(cnt), 0);
        for (int i = m - 1; i >= 0; i--)
        {
            cnt[a[i]]++;
            if (cnt[a[i]] > 1) break;
            B++;
        }
        for (int i = 0; i + m - 1 < n; i++)
        {
            ll pref = 0, suff = 0;
            ll lenpref = i + F;
            ll lensuff = n - i - m + B;
            for (int good = F; good <= lenpref && good < k; good++) pref = (pref + dp[0][lenpref][good]) % MOD;
            for (int good = B; good <= lensuff && good < k; good++) suff = (suff + dp[0][lensuff][good]) % MOD;
            dbg(i);
            pref = pref * fact(k - F) % MOD * rev(fact(k)) % MOD;
            suff = suff * fact(k - B) % MOD * rev(fact(k)) % MOD;
            si = (si + pref * suff) % MOD;
        }
        int distinct = 0;
        fill(all(cnt), 0);
        for (int i = 0; i < F; i++) cnt[a[i]]++;
        for (int i = n - 1; i > n - B - 1; i--) cnt[a[i]]++;
        for (int i = 0; i < k; i++) if (cnt[i]) distinct++;
        //cout << si << "\n";
        //cout << F << " " << B << "\n";
        //si = si * fact(k - distinct) % MOD * rev(fact(k)) % MOD;
        //cout << si << "\n";
        //cout << val << "\n";
        cout << (val + MOD - si) % MOD << "\n";
        return 0;
    }
}

/* Note:
Check constants at the beginning of the code.
N is set to 4e5 but be careful in problems with large constant factor.
Check corner cases.
No def int long long for now.
*/


Measured memory_bytes: 176768