#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) (((x) < 0)?-(x):(x))
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

using cat = long long;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

cat mod = 1000000007;

cat pw(cat a, cat e) {
	if(e <= 0) return 1;
	cat x = pw(a, e/2);
	x = (x * x) % mod;
	if(e&1) x = (x * a) % mod;
	return x;
}

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int N, K, M;
	cin >> M >> K >> N;
	vector<int> A(N);
	for(int i = 0; i < N; i++) {
		cin >> A[i];
		A[i]--;
	}
	vector<cat> pwK(M+1, 1);
	for(int i = 1; i <= M; i++) pwK[i] = pwK[i-1] * K % mod;

	cat ans = pwK[M-N] * (M-N+1) % mod;

	for(int i = 0; i <= N-K; i++) {
		vector<int> occ(K, 0);
		for(int j = 0; j < K; j++) occ[A[i+j]]++;
		bool ok = true;
		for(int j = 0; j < K; j++) if(occ[j] == 0) ok = false;
		if(ok) {
			cout << ans << "\n";
			return 0;
		}
	}
	
	int coll = 0, colr = 0;
	vector<int> occ(K, 0);
	for(int i = 0; i < N; i++) {
		if(occ[A[i]]++ == 0) coll++;
		else break;
	}
	for(int i = 0; i < K; i++) occ[i] = 0;
	for(int i = 0; i < N; i++) {
		if(occ[A[N-1-i]]++ == 0) colr++;
		else break;
	}

	vector< vector<cat> > cnt0(K+1, vector<cat>(M+1, 0));
	cnt0[0][0] = 1;
	for(int i = 0; i < M; i++) {
		cat sum = 0;
		for(int k = K-1; k >= 1; k--) {
			sum += cnt0[k][i];
			if(sum >= mod) sum -= mod;
			cnt0[k][i+1] += sum;
			if(cnt0[k][i+1] >= mod) cnt0[k][i+1] -= mod;
		}
		for(int j = 0; j < K; j++)
			cnt0[j+1][i+1] = (cnt0[j+1][i+1] + cnt0[j][i] * (K-j)) % mod;
	}

	cat facl = 1, facr = 1;
	for(int i = 1; i <= coll; i++) facl = facl * (K+1-i) % mod;
	for(int i = 1; i <= colr; i++) facr = facr * (K+1-i) % mod;
	cat invl = pw(facl, mod-2), invr = pw(facr, mod-2);
	vector<cat> inv(K+1, 1);
	for(int i = K; i >= 0; i--) {
		cat fac = 1;
		for(int j = 0; j < i; j++) fac = fac * (K-j) % mod;
		inv[i] = pw(fac, mod-2);
	}

	if(coll < N) {
		vector<cat> x(M+1, 0), y(M+1, 0);
		for(int i = 0; i <= M-N+coll; i++) for(int j = coll; j < K; j++)
			x[i-coll] = (x[i-coll] + cnt0[j][i] * invl) % mod;
		for(int i = 0; i <= M-N+colr; i++) for(int j = colr; j < K; j++)
			y[i-colr] = (y[i-colr] + cnt0[j][i] * invr) % mod;
		for(int i = 0; i <= M-N; i++) ans = (ans - x[i] * y[M-N-i]) % mod;
	}

	else {
		vector< vector<cat> > cnt1(K+1, vector<cat>(M+1, 0));
		for(int i = 0; i <= M; i++) for(int j = K-1; j > 0; j--) {
			cnt1[j][i] = cnt0[j][i] + cnt1[j+1][i];
			if(cnt1[j][i] >= mod) cnt1[j][i] -= mod;
		}
		for(int j = N; j < K; j++) for(int i = 0; i <= M-j; i++) {
			cat x = cnt0[j][i+j] * inv[N] % mod * inv[j] % mod;
			ans = (ans - cnt1[j][M-i] * x) % mod;
		}
	}

	ans %= mod;
	if(ans < 0) ans += mod;
	cout << ans << "\n";
	return 0;}

// look at my code
// my code is amazing


Measured memory_bytes: 157628