#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,a,b) for(int i=(a),_end_=(b);i<=_end_;i++)
#define DREP(i,a,b) for(int i=(a),_end_=(b);i>=_end_;i--)
#define EREP(i,u) for(int i=start[u];i;i=e[i].next)
#define fi first
#define se second
#define mkr(a,b) make_pair(a,b)
#define SZ(A) ((int)A.size())
template<class T>inline void chkmax(T &a,T b){ if(a<b)a=b;}
template<class T>inline void chkmin(T &a,T b){ if(a>b)a=b;}
inline int read()
{
	int s=0,f=1; char ch=getchar();
	while(!isdigit(ch) && ch!='-')ch=getchar();
	if(ch=='-')ch=getchar(),f=-1;
	while(isdigit(ch))s=s*10+ch-'0',ch=getchar();
	return ~f?s:-s;
}

const int maxn=25020;
const int mod=1e9+7;

int jc[maxn],jcn[maxn],inv[maxn];

inline void prepare()
{
	jc[0]=jc[1]=jcn[0]=jcn[1]=inv[1]=1;
	REP(i,2,25000)jc[i]=(ll)i*jc[i-1]%mod,inv[i]=(ll)(mod-mod/i)*inv[mod%i]%mod,jcn[i]=(ll)jcn[i-1]*inv[i]%mod;
}

inline int power(int a,int b)
{
	int ans=1;
	while(b)
	{
		if(b&1)ans=(ll)ans*a%mod;
		b>>=1;
		a=(ll)a*a%mod;
	}
	return ans;
}

inline void pls(int &a,int b){ a+=b; a-=a>=mod?mod:0;}

int n,k,m;
int a[maxn];

int vis[maxn];
int type;

inline void init()
{
	n=read();k=read();m=read();
	REP(i,1,m)a[i]=read();
	REP(i,1,m-k+1)
	{
		static int vis[maxn];
		REP(j,1,k)vis[j]=0;
		REP(j,1,k)vis[a[i+j-1]]++;
		int flg=1;
		REP(j,1,k)if(vis[j]!=1){ flg=0;break;}
		if(flg)type=3;//allin
	}
	if(type!=3)
	{
		static int vis[maxn];
		REP(j,1,m)vis[a[j]]++;
		REP(j,1,k)if(vis[j]>1)type=2;
		if(!type)type=1;
	}
}

int ans;

inline void DP(int start,int *f)
{
	static int dp[maxn][420];
	memset(dp,0,sizeof(dp));
	dp[0][start]=1;
	f[0]=1;
	REP(i,1,n)
	{
		int sum=0;
		DREP(j,k-1,1)
		{
			sum=(sum+dp[i-1][j])%mod;
			dp[i][j]=(dp[i][j]+(ll)dp[i-1][j-1]*(k-j+1))%mod;
			dp[i][j]=(dp[i][j]+sum)%mod;
		}
	}
	REP(i,1,n)REP(j,1,k-1)f[i]=(f[i]+dp[i][j])%mod;
}

#define pii pair<int,int>

inline pii operator +(pii a,pii b){ pls(a.fi,b.fi); pls(a.se,b.se);return a;}
inline pii operator *(pii a,int b){ return mkr((ll)a.fi*b%mod,(ll)a.se*b%mod);}

inline void doing()
{
	if(type==3);
	else if(type==2)
	{
		static int vis[maxn],f[maxn],g[maxn];
		int L=1,R;
		for(L=1;!vis[a[L]];L++)vis[a[L]]=1;
		L--;
		memset(vis,0,sizeof(int)*(k+1));
		for(R=m;!vis[a[R]];R--)vis[a[R]]=1;
		R++;
		DP(L,f); DP(m-R+1,g);
		REP(i,0,n-m)ans=(ans+(ll)f[i]*g[n-m-i])%mod;
	}else
	{
		static pii dp[25020][420];
		dp[0][0]=mkr(1,0);
		REP(i,1,n)
		{
			pii sum=mkr(0,0);
			DREP(j,k-1,1)
			{
				sum=(sum+dp[i-1][j]);
				dp[i][j]=(dp[i][j]+dp[i-1][j-1]*(k-j+1));
				dp[i][j]=(dp[i][j]+sum);
			}
			REP(j,m,k-1)pls(dp[i][j].se,dp[i][j].fi);
		}
		pii sum=mkr(0,0);
		REP(j,1,k-1)sum=sum+dp[n][j];
		ans=(ll)sum.se*jcn[k]%mod*jc[k-m]%mod;
	}
	ans=((ll)power(k,n-m)*(n-m+1)-ans+mod)%mod;
	printf("%d\n",ans);
}

int main()
{
	prepare();
	init();
	doing();
	return 0;
}
