#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
using namespace std;
inline int read()
{
	int f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
inline void write(int x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
inline void pr1(int x){write(x);putchar(' ');}
inline void pr2(int x){write(x);putchar('\n');}
const int MAXN=25005;
const int MAXM=405;
const int mod=1e9+7;
int pow_mod(int a,int b)
{
	int ret=1;
	while(b)
	{
		if(b&1)ret=1LL*ret*a%mod;
		a=1LL*a*a%mod;b>>=1;
	}
	return ret;
}
int f[MAXN][MAXM],s[MAXM],s1[MAXM],g[MAXN][MAXM];
int n,K,m,a[MAXN];
int pre[MAXN],inv[MAXN];
LL ans;
bool check1()
{
	int cnt=0;
	if(m<K)return false;
	for(int i=1;i<K;i++)
	{
		s[a[i]]++;
		if(s[a[i]]==1)cnt++;
	}
	for(int i=1;i<=m-K+1;i++)
	{
		s[a[i+K-1]]++;
		if(s[a[i+K-1]]==1)cnt++;
		if(cnt==K)return true;
		s[a[i]]--;
		if(s[a[i]]==0)cnt--;
	}
	return false;
}
bool check2()
{
	if(m>K)return false;
	memset(s,0,sizeof(s));
	for(int i=1;i<=m;i++)
	{
		s[a[i]]++;
		if(s[a[i]]>1)return false;
	}
	return true;
}
void ad(int &x,int y){x+=y;if(x>=mod)x-=mod;}
int C(int n,int m){return 1LL*pre[n]*inv[m]%mod*inv[n-m]%mod;}
void solve2()
{
	memset(s,0,sizeof(s));
	s[0]=s1[0]=f[0][0]=1;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=min(i,K);j++)
		{
			ad(f[i][j],s[j]);ad(f[i][j],1LL*f[i-1][j-1]*(K-j+1)%mod);
			ad(g[i][j],s1[j]);
			ad(g[i][j],1LL*g[i-1][j-1]*(K-j+1)%mod);
			if(j>=m)ad(g[i][j],f[i][j]);
		}
		for(int j=K-1;j>=0;j--)s[j]=(s[j+1]+f[i][j])%mod,s1[j]=(s1[j+1]+g[i][j])%mod;
	}
	int sum=0;
	for(int i=1;i<K;i++)ad(sum,g[n][i]);
	sum=1LL*sum*pre[K-m]%mod*inv[K]%mod;
	pr2((ans-sum+mod)%mod);	
}
void solve3()
{
	memset(s,0,sizeof(s));
	int ln1,ln2;
	for(int i=1;i<=m;i++)
	{
		s[a[i]]++;
		if(s[a[i]]>1){ln1=i-1;break;}
	}
	memset(s,0,sizeof(s));
	for(int i=m;i>=1;i--)
	{
		s[a[i]]++;
		if(s[a[i]]>1){ln2=m-i;break;}
	}
	int sum=0;
	for(int i=ln1;i-ln1+1+m-1<=n;i++)
	{
		int s1=0,s2=0;
		for(int j=ln1;j<K;j++)ad(s1,1LL*f[i][j]*pre[K-j]%mod*inv[K]%mod*C(K-ln1,j-ln1)%mod*pre[j-ln1]%mod);
		for(int j=ln2;j<K;j++)ad(s2,1LL*f[n-(i-ln1+1+m-1)+ln2][j]*pre[K-j]%mod*inv[K]%mod*C(K-ln2,j-ln2)%mod*pre[j-ln2]%mod);
		ad(sum,1LL*s1*s2%mod);
	}
	pr2((ans-sum+mod)%mod);
}
int main()
{
	pre[0]=1;for(int i=1;i<MAXN;i++)pre[i]=1LL*pre[i-1]*i%mod;
	inv[MAXN-1]=pow_mod(pre[MAXN-1],mod-2);
	for(int i=MAXN-2;i>=0;i--)inv[i]=1LL*inv[i+1]*(i+1)%mod;
	n=read();K=read();m=read();
	for(int i=1;i<=m;i++)a[i]=read();
	ans=1LL*pow_mod(K,n-m)*(n-m+1)%mod;
	if(check1())return pr2(ans),0;//colorful
	
	if(check2())solve2();
	else 
	{
		memset(s,0,sizeof(s));
		s[0]=f[0][0]=1;
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=min(i,K);j++)
			{
				ad(f[i][j],s[j]);
				ad(f[i][j],1LL*f[i-1][j-1]*(K-j+1)%mod);
			}
			s[K]=0;
			for(int j=K-1;j>=0;j--)s[j]=(s[j+1]+f[i][j])%mod;
		}
		solve3();
	}
	return 0;
}


Measured memory_bytes: 79488