#include<bits/stdc++.h>
#define p 1000000007
#define ll long long 
using namespace std;
ll t[410];
ll a[25010];
inline ll power(ll x, ll y)
{
	ll Ans = 1;
	while(y)
	{
		if(y & 1)
			Ans = Ans * x % p;
		y >>= 1;
		x = x * x % p;
	}
	return Ans;
}
ll jc[25010];
ll ny[25010];
ll dp1[25010][410];
ll dp2[25010][410];
ll dp[25010][410][2];
ll f[410];
int main()
{
	ll n, k, m;
	scanf("%lld%lld%lld", &n, &k, &m);
	for(ll i = 1; i <= m; ++ i)
		scanf("%lld", &a[i]);
	jc[0] = 1;
	for(ll i = 1; i <= 25000; ++ i)
		jc[i] = jc[i - 1] * i % p;
	for(ll i = 1; i <= 25000; ++ i)
		ny[i] = power(jc[i], p - 2);
	ll tot = 0;
	for(ll i = 1; i <= min(k, m); ++ i)
	{
		if(t[a[i]] == 0)
			++ tot;
		++ t[a[i]];
	}
	bool b = false;
	if(tot == k)
		b = true;
	for(ll i = 1; i <= m - k; ++ i)
	{
		if(t[a[i]] == 1)
			-- tot;
		-- t[a[i]];
		if(t[a[i + k]] == 0)
			++ tot;
		++ t[a[i + k]];
		if(tot == k)
			b = true;
	}
	if(b)
	{
		printf("%lld", (n - m + 1) * power(k, n - m) % p);
		return 0;
	}
	memset(t, 0, sizeof(t));
	for(ll i = 1; i <= m; ++ i)
		++ t[a[i]];
	b = false;
	for(ll i = 1; i <= m; ++ i)
		if(t[a[i]] > 1)
			b = true;
	if(b)
	{
		memset(t, 0, sizeof(t));
		for(ll i = 1; i <= m; ++ i)
		{
			++ t[a[i]];
			if(t[a[i]] > 1)
			{
				dp1[0][i - 1] = 1;
				break;
			}
		}
		for(ll i = 0; i < n; ++ i)
		{
			memset(f, 0, sizeof(f));
			for(ll j = 1; j < k; ++ j)
			{
				dp1[i + 1][j + 1] = (dp1[i + 1][j + 1] + dp1[i][j] * (k - j)) % p;
				f[1] = (f[1] + dp1[i][j]) % p;
				f[j + 1] = (f[j + 1] - dp1[i][j]) % p;
			}
			dp1[i + 1][k] = 0;
			for(ll j = 1; j <= k; ++ j)
				f[j] = (f[j] + f[j - 1]) % p;
			for(ll j = 1; j < k; ++ j)
				dp1[i + 1][j] = (dp1[i + 1][j] + f[j]) % p;
		}
		memset(t, 0, sizeof(t));
		for(ll i = m; i >= 1; -- i)
		{
			++ t[a[i]];
			if(t[a[i]] > 1)
			{
				dp2[0][m - i] = 1;
				break;
			}
		}
		for(ll i = 0; i < n; ++ i)
		{
			memset(f, 0, sizeof(f));
			for(ll j = 1; j < k; ++ j)
			{
				dp2[i + 1][j + 1] = (dp2[i + 1][j + 1] + dp2[i][j] * (k - j)) % p;
				f[1] = (f[1] + dp2[i][j]) % p;
				f[j + 1] = (f[j + 1] - dp2[i][j]) % p;
			}
			dp2[i + 1][k] = 0;
			for(ll j = 1; j <= k; ++ j)
				f[j] = (f[j] + f[j - 1]) % p;
			for(ll j = 1; j < k; ++ j)
				dp2[i + 1][j] = (dp2[i + 1][j] + f[j]) % p;
		}
		ll Ans = 0;
		for(ll i = 1; i <= n - m + 1; ++ i)
		{
			ll d = 0;
			for(ll j = 1; j < k; ++ j)
				d = (d + dp1[i - 1][j]) % p;
			ll e = 0;
			for(ll j = 1; j < k; ++ j)
				e = (e + dp2[n - i - m + 1][j]) % p;
			Ans = (Ans + d * e) % p;
		}
		printf("%lld", ((n - m + 1) * power(k, n - m) % p - Ans + p) % p);
		return 0;
	}
	dp[1][1][0] = k; 
	for(ll i = 1; i <= n; ++ i)
	{
		memset(f, 0, sizeof(f));
		for(ll j = 1; j < k; ++ j)
		{
			dp[i + 1][j + 1][0] = (dp[i + 1][j + 1][0] + dp[i][j][0] * (k - j)) % p;
			f[1] = (f[1] + dp[i][j][0]) % p;
			f[j + 1] = (f[j + 1] - dp[i][j][0]) % p;
		}
		dp[i + 1][k][0] = 0;
		for(ll j = 1; j <= k; ++ j)
			f[j] = (f[j] + f[j - 1]) % p;
		for(ll j = 1; j < k; ++ j)
			dp[i + 1][j][0] = (dp[i + 1][j][0] + f[j]) % p;
		for(ll j = m; j < k; ++ j)
			dp[i][j][1] = (dp[i][j][1] + dp[i][j][0] * jc[k - m] % p * ny[k] % p) % p;
		memset(f, 0, sizeof(f));
		for(ll j = 1; j < k; ++ j)
		{
			dp[i + 1][j + 1][1] = (dp[i + 1][j + 1][1] + dp[i][j][1] * (k - j)) % p;
			f[1] = (f[1] + dp[i][j][1]) % p;
			f[j + 1] = (f[j + 1] - dp[i][j][1]) % p;
		}
		for(ll j = 1; j <= k; ++ j)
			f[j] = (f[j] + f[j - 1]) % p;
		for(ll j = 1; j < k; ++ j)
			dp[i + 1][j][1] = (dp[i + 1][j][1] + f[j]) % p;
	}
	ll Ans = 0;
	for(ll i = 1; i < k; ++ i)
		Ans = (Ans + dp[n][i][1]) % p;
	printf("%lld", ((n - m + 1) * power(k, n - m) % p - Ans + p) % p);
	return 0;
}

Measured memory_bytes: 162432