#include<bits/stdc++.h>
#define For(i,l,r) for(int i = (l),i##end = (r);i <= i##end;i++)
#define Fordown(i,r,l) for(int i = (r),i##end = (l);i >= i##end;i--)
#define debug(x) cout << #x << " = " << x << endl

using namespace std;

typedef long long ll;

template <typename T> inline bool chkmin(T &x,T y) { return y < x ? x = y,1 : 0; }
template <typename T> inline bool chkmax(T &x,T y) { return x < y ? x = y,1 : 0; }

const int INF = 0x3f3f3f3f;
const int N = 25000 + 10,K = 400 + 10,mod = 1e9 + 7;

int a[N],vis[N];

int n,k,m;

inline int read() {
	int x = 0,flag = 1;
	char ch = getchar();
	while(!isdigit(ch) && ch != '-')ch = getchar();
	if(ch == '-')flag = -1,ch = getchar();
	while(isdigit(ch))x = (x << 3) + (x << 1) + (ch - '0'),ch = getchar();
	return x * flag;
}

inline int fpm(int Bs,int b) {
	int res = 1;
	while(b) {
		if(b & 1) res = 1ll * res * Bs % mod;
		Bs = 1ll * Bs * Bs % mod,b /= 2;
	}
	return res;
}
inline int Mod(int val) {
	if(val >= mod) val -= mod;
	if(val < 0) val += mod;
	return val;
}

namespace Case1 {
	int L[N],R[N],V[N],dp[N][K],Sum[N][K];
	inline void Dp(int A[],int cnt) {
		memset(dp,0,sizeof(dp)),memset(Sum,0,sizeof(Sum));
		dp[0][cnt] = 1;
		For(i,0,cnt) Sum[0][i] = 1;
		For(i,1,n) {
			Fordown(j,k - 1,1) {
				dp[i][j] = (Sum[i - 1][j] + 1ll * dp[i - 1][j - 1] * (k - j + 1)) % mod;
				Sum[i][j] = Mod(Sum[i][j + 1] + dp[i][j]);
			}
			Sum[i][0] = Sum[i][1];
		}
		For(i,0,n) A[i] = Sum[i][0];
	}
	inline int Solve() {
		int posl = m,posr = m;
		For(i,1,m) {
			if(V[a[i]]) { posl = i - 1;break; }
			V[a[i]] = true;
		}
		For(i,1,k) V[i] = false;
		Fordown(i,m,1) {
			if(V[a[i]]) { posr = m - i;break; }
			V[a[i]] = true;
		}
		int Sign = 1;
		For(i,1,m - k + 1) {
			For(j,1,k) V[j] = false;
			For(j,i,i + k - 1) V[a[j]] = true;
			bool flag = true;
			For(j,1,k) if(!V[j]) flag = false;
			if(flag) { Sign = 0;break; }
		}
		Dp(L,posl),Dp(R,posr);
		int ans = 0;
		For(i,1,n - m + 1)
			ans = (ans + fpm(k,n - m) - 1ll * Sign * L[i - 1] * R[n - i - m + 1]) % mod;
		return (ans + mod) % mod;
	}
}
namespace Case2 {
	int Ans[N],dp[N][K][2],Sum[N][K][2],tot[N][K][2],Stot[N][K][2];
	inline int Dp() {
		dp[0][0][0] = Sum[0][0][0] = 1;
		For(i,1,n) {
			For(l,0,1) {
				dp[i][k][1] = (dp[i][k][1] + Sum[i - 1][k - 1][l]) % mod;
				tot[i][k][1] = (1ll * tot[i][k][1] + Stot[i - 1][k - 1][l] + Sum[i - 1][k - 1][l]) % mod;
				Sum[i][k][1] = dp[i][k][1],Stot[i][k][1] = tot[i][k][1];
			}
			Fordown(j,k - 1,1) For(l,0,1) {
				dp[i][j][l] = (Sum[i - 1][j][l] + 1ll * dp[i - 1][j - 1][l] * (k - j + 1)) % mod;
				tot[i][j][l] = (Stot[i - 1][j][l] + 1ll * tot[i - 1][j - 1][l] * (k - j + 1) + (j >= m ? dp[i][j][l] : 0)) % mod;
				Sum[i][j][l] = Mod(Sum[i][j + 1][l] + dp[i][j][l]);
				Stot[i][j][l] = Mod(Stot[i][j + 1][l] + tot[i][j][l]);
			}
			For(l,0,1) {
				Sum[i][0][l] = Sum[i][1][l];
				Stot[i][0][l] = Stot[i][1][l];
			}
		}
		return Stot[n][0][1];
	}
	inline int Solve() {
		int prod = 1;
		For(i,k - m + 1,k) prod = 1ll * prod * i % mod;
		int ans = 1ll * Dp() * fpm(prod,mod - 2) % mod;
		return ans;
	}
}

int main() {

	n = read(),k = read(),m = read();
	bool flag = false;
	For(i,1,m) {
		a[i] = read();
		if(vis[a[i]]) flag = true;
		vis[a[i]] = true;
	}
	if(flag) printf("%d\n",Case1 :: Solve());
	else printf("%d\n",Case2 :: Solve());

	return 0;
}

Measured memory_bytes: 321792