#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef vector<vector<ll>> mat;
typedef vector<ll> vec;

void debug(vec &v) {
	int n = v.size();
	rep(i, n) {
		if (i > 0)cout << " ";
		cout << v[i];
	}
	cout << "\n";
}

ll mod_pow(ll x, ll n) {
	ll ret = 1;
	while (n > 0) {
		if (n % 2)ret = ret * x%mod;
		x = x * x%mod; n >>= 1;
	}
	return ret;
}
struct perm {
private:
	int sz;
	vector<ll> p, invp;
public:
	perm(int n) {
		sz = n + 1;
		p.resize(sz), invp.resize(sz);
		p[0] = 1;
		rep1(i, sz - 1) {
			p[i] = p[i - 1] * i%mod;
		}
		invp[sz - 1] = 1;
		ll cop = mod - 2, x = p[sz - 1];
		while (cop) {
			if (cop % 2)invp[sz - 1] = invp[sz - 1] * x%mod;
			cop >>= 1; x = x * x % mod;
		}
		per(i, sz - 1) {
			invp[i] = invp[i + 1] * (i + 1) % mod;
		}
	}
	ll comb(ll x, ll y) {
		if (x < y || y < 0)return 0;
		ll ret = p[x];
		(ret *= invp[y]) %= mod;
		(ret *= invp[x - y]) %= mod;
		return ret;
	}
	ll combP(ll x, ll y) {
		if (x < y || y < 0)return 0;
		return p[x] * invp[x - y] % mod;
	}
};
perm pm(1 << 18);

bool used[401];

ll dp[401];
ll nex[401];
ll rnex[401];
ll memo[25001];

ll dp2[401][2];
ll nex2[401][2];
ll rnex2[401][2];
void solve(){
	int n, k, m; cin >> n >> k >> m;
	vector<int> a(m);
	rep(i, m)cin >> a[i];
	if (n < k) {
		cout << 0 << endl; return;
	}
	if (k == 1) {
		cout << 1 << endl; return;
	}
	if(m>=k){
		//already
		vector<int> cnt(k + 1,0);
		int tmp = 0;
		rep(i, k) {
		    cnt[a[i]]++;
			if (cnt[a[i]] == 1)tmp++;
		}
		bool alr = false;
		if (tmp == k)alr = true;
		rep(i, m - k) {
			if (a[i + k] <= k) {
				cnt[a[i+k]]++;
				if (cnt[a[i+k]] == 1)tmp++;
			}
			if (a[i] <= k) {
				cnt[a[i]]--;
				if (cnt[a[i]] == 0)tmp--;
			}
			if (tmp == k)alr = true;
		}
		if (alr) {
			ll ans = mod_pow(k,n-m)*(n-m+1)%mod;
			cout << ans << endl; return;
		}
	}
	int cl = 0;
	fill(used, used + k+1, false);
	rep(i, m) {
		if (used[a[i]])break;
		used[a[i]] = true; cl++;
	}
	int cr = 0;
	fill(used, used + k + 1, false);
	per(i, m) {
		if (used[a[i]])break;
		used[a[i]] = true; cr++;
	}
	ll ans = 0;
	if (cl == m) {
		dp2[1][0] = k;
		if (m == 1)dp2[1][1] = k;
		for (int i = 2; i <= n; i++) {
			rep(l, 2) {
				for (int j = 1; j < k; j++) {
					(nex2[j + 1][l] += dp2[j][l] * (k - j)) %= mod;
					(rnex2[j][l] += dp2[j][l]) %= mod;
				}
				for (int j = k - 1; j >= 1; j--) {
					(rnex2[j][l] += rnex2[j + 1][l]) %= mod;
					(nex2[j][l] += rnex2[j][l]) %= mod;
				}
				rep1(j, k) {
					dp2[j][l] = nex2[j][l];
					nex2[j][l] = 0;
					rnex2[j][l] = 0;
				}
			}
			for (int j = m; j < k; j++) {
				(dp2[j][1] += dp2[j][0]) %= mod;
			}
		}
		for (int j = 1; j < k; j++) {
			ans += dp2[j][1];
		}
		ans %= mod;
		//cout << ans << endl;
		ans = mod_pow(k, n - m)*(n - m + 1) % mod*pm.combP(k, m) % mod-ans;
		//ans = mod_pow(k, n-m)*(n - m + 1) - ans;
		ans = (ans%mod + mod) % mod;
		ans = ans * mod_pow(pm.combP(k, m), mod - 2) % mod;
		cout << ans << endl; return;
	}
	rep(i, k + 1)dp[i] = 0;
	dp[cl] = 1;
	for (int i = 1; i <= n - m; i++) {
		for (int j = 1; j < k; j++) {
			//+1
			(nex[j + 1] += dp[j] * (k - j)) %= mod;
			//to 1~j
			(rnex[j] += dp[j]) %= mod;
		}
		for (int j = k - 1; j >= 1; j--) {
			(rnex[j] += rnex[j + 1]) %= mod;
			(nex[j] += rnex[j]) %= mod;
		}
		rep1(j, k) {
			dp[j] = nex[j];
			nex[j] = 0;
			rnex[j] = 0;
		}
		memo[i] = dp[k];
	}
	//cout << memo[1] << endl;
	vector<ll> vl(n - m + 1);
	vl[0] = 0;
	rep1(i, n - m) {
		(memo[i] += memo[i - 1] * k) %= mod;
		vl[i] = memo[i];
	}
	rep(i, k + 1)dp[i] = 0;
	dp[cr] = 1;
	for (int i = 1; i <= n - m; i++) {
		for (int j = 1; j < k; j++) {
			//+1
			(nex[j + 1] += dp[j] * (k - j)) %= mod;
			//to 1~j
			(rnex[j] += dp[j]) %= mod;
		}
		for (int j = k - 1; j >= 1; j--) {
			(rnex[j] += rnex[j + 1]) %= mod;
			(nex[j] += rnex[j]) %= mod;
		}
		rep1(j, k) {
			dp[j] = nex[j];
			nex[j] = 0;
			rnex[j] = 0;
		}
		memo[i] = dp[k];
	}
	vector<ll> vr(n - m + 1);
	vr[0] = 0;
	rep1(i, n - m) {
		(memo[i] += memo[i - 1] * k) %= mod;
		vr[i] = memo[i];
	}
	rep(i, n - m + 1) {
		int le = i, ri = n - m - i;
		//cout << le << " " << ri << " ";
		//cout << vl[le] << " " << vr[ri] << endl;
		ll cop = ans;
		ans += vl[le] * mod_pow(k, ri) + mod_pow(k, le)*vr[ri] - vl[le] * vr[ri];
		//ans += vl[le] * (mod_pow(k, ri) - vr[ri]) + (mod_pow(k, le) - vl[le])*vr[ri];
		ans = (ans%mod + mod) % mod;
		//
		//cout << ans - cop << endl;
	}
	cout << ans << endl;
}


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(12);
	//init();
	//int t; cin >> t; rep(i, t)solve();
	solve();
	stop
	return 0;
}


Measured memory_bytes: 4992