#include <bits/stdc++.h>

using namespace std;

int dp[25050][405];
int dp2[25050][405];
int n,m,k;
int seq[25050];
int app[405],cnt;
int pref[405];
int X[25050],Y[25050];
int su[405],su2[405];
const int mod = 1000000007;

int qpow(int base,int tms)
{
	int tmp = 1;
	while(tms)
	{
		if(tms & 1) tmp = tmp * 1ll * base % mod;
		base = base * 1ll * base % mod;
		tms >>= 1;
	}
	return tmp;
}

long long A(int n,int m)
{
	long long su1 = 1,su2 = 1;
	for(int i = 1;i <= n; ++ i)
		su1 = su1 * 1ll * i % mod;
	for(int i = 1;i <= n - m; ++ i)
		su2 = su2 * 1ll * i % mod;
	return su1 * 1ll * qpow(su2,mod - 2) % mod;
}

int main()
{
	scanf("%d%d%d",&n,&k,&m);
	for(int i = 1;i <= m; ++ i) scanf("%d",&seq[i]);
	bool flg = 0,same = 0;
	for(int i = 1;i <= m; ++ i)
	{
		pref[seq[i]] ++;
		if(pref[seq[i]] > 1) same = 1;
		app[seq[i]] ++;
		if(app[seq[i]] == 1) cnt ++;
		if(i - k >= 1)
		{
			app[seq[i - k]] --;
			if(app[seq[i - k]] == 0) cnt --;
		}
		if(cnt == k)
		{
			flg = 1;
			break;
		}
	}
	if(flg)
	{
		printf("%lld\n",(n - m + 1) * 1ll * qpow(k,n - m) % mod);
		return 0;
	}
	else
	{
		if(same)
		{
			memset(app,0,sizeof(app));
			int pre = 1;
			for(int i = 1;i <= m; ++ i)
			{
				app[seq[i]] ++;
				while(app[seq[i]] > 1)
					app[seq[pre ++]] --;
			}
			int st = m - pre + 1;
			dp[0][st] = 1;
			for(int i = 0;i < n; ++ i)
			{
				for(int j = k - 1;j >= 1; -- j)
					su[j] = (su[j] + su[j + 1]) % mod;
				for(int j = k - 1;j >= 1; -- j)
				{
					dp[i][j] = (dp[i][j] + su[j]) % mod;
					X[i] = (X[i] + dp[i][j]) % mod;
					su[j] = dp[i][j];
					if(j < k)
						dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j] * 1ll * (k - j) % mod) % mod;
				}
			}
			memset(dp,0,sizeof(dp));
			memset(su,0,sizeof(su));
			long long as = (n - m + 1) * 1ll * qpow(k,n - m) % mod;
			pre = m;
			memset(app,0,sizeof(app));
			for(int i = m;i >= 1; -- i)
			{
				app[seq[i]] ++;
				while(app[seq[i]] > 1) app[seq[pre --]] --;
			}
			st = pre;
			dp[0][st] = 1;
			for(int i = 0;i < n; ++ i)
			{
				for(int j = k - 1;j >= 1; -- j)
					su[j] = (su[j] + su[j + 1]) % mod;
				for(int j = k - 1;j >= 1; -- j)
				{
					dp[i][j] = (dp[i][j] + su[j]) % mod;
					Y[i] = (Y[i] + dp[i][j]) % mod;
					su[j] = dp[i][j];
					if(j < k)
						dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j] * 1ll * (k - j) % mod) % mod;
				}
			}
			for(int i = 0;i <= n - m; ++ i)
				as = (as - X[i] * 1ll * Y[n - m - i] % mod + mod) % mod;
			printf("%lld\n",as);
		}
		else
		{
			dp2[1][1] = k;
			for(int i = 1;i <= n; ++ i)
			{
				for(int j = k - 1;j >= 1; -- j)
					su[j] = (su[j] + su[j + 1]) % mod,
					su2[j] = (su2[j] + su2[j + 1]) % mod;
				for(int j = k - 1;j >= 1; -- j)
				{
					dp[i][j] = (dp[i][j] + su[j]) % mod;
					dp2[i][j] = (dp2[i][j] + su2[j]) % mod;
					if(j >= m)
						dp[i][j] = (dp[i][j] + dp2[i][j]) % mod;
					su[j] = dp[i][j];
					su2[j] = dp2[i][j];
					if(j < k)
					{
						dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j] * 1ll * (k - j) % mod) % mod;
						dp2[i + 1][j + 1] = (dp2[i + 1][j + 1] + dp2[i][j] * 1ll * (k - j) % mod) % mod;
					}
				}
			}
			long long as = (n - m + 1) * 1ll * qpow(k,n - m) % mod;
			long long sum = 0;
			for(int i = 1;i < k; ++ i)
				sum = (sum + dp[n][i]) % mod;
			sum = sum * 1ll * qpow(A(k,m),mod - 2) % mod;
			printf("%lld\n",(as - sum + mod) % mod);
		}
	}
}

Measured memory_bytes: 79488