#include <bits/stdc++.h>
using namespace std;
#define ri register int
typedef long long ll;
namespace io {
	const int SIZE = (1 << 21) + 1;
	char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c, qu[55]; int f, qr;
	// getchar
	#define gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	// print the remaining part
	inline void flush () {
		fwrite (obuf, 1, oS - obuf, stdout);
		oS = obuf;
	}
	// putchar
	inline void putc (char x) {
		*oS ++ = x;
		if (oS == oT) flush ();
	}
	// input a signed integer
	template <class I>
	inline void gi (I &x) {
		for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;
		for (x = 0; c <= '9' && c >= '0'; c = gc()) x = (x << 1) + (x << 3) + (c & 15); x *= f;
	}
	// input a signed integer
	template <class I>
	inline void read (I &x, int p) {
		for (c = gc(); c < '0' || c > '9'; c = gc()) ;
		for (x = 0; c <= '9' && c >= '0'; c = gc()) x = ( (x << 1) + (x << 3) + (c & 15) ) % p; 
	}
	// print a signed integer
	template <class I>
	inline void print (I x) {
		if (!x) putc ('0'); if (x < 0) putc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10;
		while (qr) putc (qu[qr --]);
	}
	// no need to call flush at the end manually!
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
} 
using io :: gi;
using io :: read;
using io :: putc;
using io :: print;
const int N=25e3+5,K=405,mod=1e9+7;
int n,k,m,ans,a[N];
inline int fpow(ri a,ri b){
	ri ans=1;
	for(;b;b>>=1,a=(ll)a*a%mod)
		if(b&1) ans=(ll)ans*a%mod;
	return ans; 
}
int cnt[K],cntcol;
inline void add(ri c){
	if(++cnt[c]==1) ++cntcol;
}
inline void del(ri c){
	if(!--cnt[c]) --cntcol;
}
inline bool check(){
	ri i;
	for(i=1;i<=m;++i){
		add(a[i]);
		if(i-k>0) del(a[i-k]);
		if(cntcol==k) return true;
	}
	return false;
}
inline bool check2(){
	ri i;
	for(i=1;i<=k;++i) cnt[i]=0;
	for(i=1;i<=m;++i){
		if(cnt[a[i]]==1)
			return true;
		cnt[a[i]]=1;
	}
	return false;
}
int pre[N][K],pres[N][K],suf[N][K],sufs[N][K];
inline void dp2(){
	ri i,j,l;
	for(i=1;i<=k;++i) cnt[i]=0;
	l=0;
	for(i=1;i<=m;++i){
		if(cnt[a[i]]==1)
			break;
		cnt[a[i]]=1;
		++l;
	}
	pre[0][l]=1;
	for(j=l;j;--j) pres[0][j]=1;
	for(i=1;i<=n-m;++i)
		for(j=k-1;j;--j)
			pre[i][j]=((ll)pre[i-1][j-1]*(k-(j-1))+pres[i-1][j])%mod,
			pres[i][j]=(pres[i][j+1]+pre[i][j])%mod;
	
	for(i=1;i<=k;++i) cnt[i]=0;
	l=0;
	for(i=m;i;--i){
		if(cnt[a[i]]==1)
			break;
		cnt[a[i]]=1;
		++l;
	}
	suf[0][l]=1;
	for(j=l;j;--j) sufs[0][j]=1;
	for(i=1;i<=n-m;++i)
		for(j=k-1;j;--j)
			suf[i][j]=((ll)suf[i-1][j-1]*(k-(j-1))+sufs[i-1][j])%mod,
			sufs[i][j]=(sufs[i][j+1]+suf[i][j])%mod;
	
	for(i=1;i<=n-m+1;++i)
		ans=(ans-(ll)pres[i-1][1]*sufs[n-m-(i-1)][1])%mod;
	ans=ans<0?ans+mod:ans;
	printf("%d\n",ans);
}
int fac[K],ifac[K];
inline int A(ri n,ri m){
	return m<0||n<m?0:(ll)fac[n]*ifac[n-m]%mod; 
}
int f[N][K],g[N][K],sf[N][K],sg[N][K];
inline void dp3(){
	ri i,j;
	fac[0]=1;
	for(i=1;i<=k;++i) fac[i]=(ll)fac[i-1]*i%mod;
	ifac[k]=fpow(fac[k],mod-2);
	for(i=k;i;--i) ifac[i-1]=(ll)ifac[i]*i%mod;
	f[1][1]=sf[1][1]=k;
	if(m==1)
		g[1][1]=sg[1][1]=k;
	for(i=2;i<=n;++i)
		for(j=k-1;j;--j)
			f[i][j]=((ll)f[i-1][j-1]*(k-(j-1))+sf[i-1][j])%mod,
			g[i][j]=((ll)g[i-1][j-1]*(k-(j-1))+sg[i-1][j]+(j>=m?f[i][j]:0))%mod,
			sf[i][j]=(sf[i][j+1]+f[i][j])%mod,
			sg[i][j]=(sg[i][j+1]+g[i][j])%mod;
	ans=(ans-(ll)sg[n][1]*fpow(A(k,m),mod-2)%mod+mod)%mod;
	printf("%d\n",ans);
}
int main(){
	ri i;
	gi(n);gi(k);gi(m);
	for(i=1;i<=m;++i) gi(a[i]);
	ans=(ll)fpow(k,n-m)*(n-m+1)%mod; 
	if(check())
		return printf("%d\n",ans),0;
	if(check2())
		dp2();
	else
		dp3();
    return 0;
}

Measured memory_bytes: 164096