#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<bitset>
#include<math.h>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
const int N=250000+100,K=400+50;
const db pi=acos(-1.0);
#define lowbit(x) (x)&(-x)
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define go(u,i) for (register int i=head[u],v=sq[i].to;i;i=sq[i].nxt,v=sq[i].to)
#define fir first
#define sec second
#define mkp make_pair
#define pb push_back
#define maxd 1000000007
#define eps 1e-8
inline int read()
{
    int x=0,f=1;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;
}

namespace My_Math{
	#define N 250000

	int fac[N+100],invfac[N+100];

	int add(int x,int y) {return x+y>=maxd?x+y-maxd:x+y;}
	int dec(int x,int y) {return x<y?x-y+maxd:x-y;}
	int mul(int x,int y) {return 1ll*x*y%maxd;}
	ll qpow(ll x,int y)
	{
		ll ans=1;
		while (y)
		{
			if (y&1) ans=mul(ans,x);
			x=mul(x,x);y>>=1;
		}
		return ans;
	}
	int getinv(int x) {return qpow(x,maxd-2);}

	int C(int n,int m)
	{
		if ((n<m) || (n<0) || (m<0)) return 0;
		return mul(mul(fac[n],invfac[m]),invfac[n-m]);
	}

	void math_init()
	{
		fac[0]=invfac[0]=1;
		rep(i,1,N) fac[i]=mul(fac[i-1],i);
		invfac[N]=getinv(fac[N]);
		per(i,N-1,1) invfac[i]=mul(invfac[i+1],i+1);
	}
	#undef N
}
using namespace My_Math;

int n,m,k,a[N],f[N][K],g[N][K],sumf[N][K],sumg[N][K],tax[K],ans;

bool chk()
{
	memset(tax,0,sizeof(tax));
	if (m<k) return 0;
	int now=0;
	rep(i,1,k)
	{
		tax[a[i]]++;
		if (tax[a[i]]==1) now++;
	}
	if (now==k) return 1;
	rep(i,k+1,m)
	{
		tax[a[i-k]]--;
		if (!tax[a[i-k]]) now--;
		tax[a[i]]++;
		if (tax[a[i]]==1) now++;
		if (now==k) return 1;
	}
	return 0;
}

void dp()
{
	f[0][0]=1;
	rep(i,1,n) 
	{
		rep(j,1,k-1)
		{
			f[i][j]=add(mul(f[i-1][j-1],k-j+1),sumf[i-1][j]);
			g[i][j]=add(mul(g[i-1][j-1],k-j+1),sumg[i-1][j]);
			if (j>=m) g[i][j]=add(g[i][j],f[i][j]);
		}
		per(j,k-1,1)
		{
			sumg[i][j]=add(sumg[i][j+1],g[i][j]);
			sumf[i][j]=add(sumf[i][j+1],f[i][j]);
		}
	}
}

int find()
{
	int now=0;
	memset(tax,0,sizeof(tax));
	rep(i,1,m)
	{
		if (tax[a[i]]) break;
		tax[a[i]]++;now++;
	}
	return now;
}

void solve1()
{
	int tmp=mul(sumg[n][1],mul(fac[k-m],invfac[k]));
	ans=dec(ans,tmp);
	printf("%d\n",ans);
}

void solve2()
{
	/*rep(i,1,n)
	{
		rep(j,1,k-1) cout << f[i][j] << " ";
		cout << endl;
	}*/
	int llen,rlen,tmp=0;llen=find();
	reverse(a+1,a+1+m);rlen=find();
	//cout << llen << " " << rlen << endl;
	rep(i,1,n-m+1)
	{
		int tmp1=0,tmp2=0;
		int i1=i+llen-1;
		rep(j,llen,k-1)
		{
			int inv=mul(fac[k-j],invfac[k]),num=mul(fac[k-llen],invfac[k-j]);
			tmp1=add(tmp1,mul(f[i1][j],mul(inv,num)));
		}
		i1=n-m-i+1+rlen;
		rep(j,rlen,k-1)
		{
			int inv=mul(fac[k-j],invfac[k]),num=mul(fac[k-rlen],invfac[k-j]);
			tmp2=add(tmp2,mul(f[i1][j],mul(inv,num)));
		}
		tmp=add(tmp,mul(tmp1,tmp2));
	}
	ans=dec(ans,tmp);
	printf("%d\n",ans);
}

int main()
{
	n=read();k=read();m=read();
	rep(i,1,m) a[i]=read();
	math_init();
	ans=mul(n-m+1,qpow(k,n-m));
	if (chk()) 
	{
		printf("%d",ans);
		return 0;
	}
	dp();
	int len=find();
	if (len==m) solve1();else solve2();
	return 0;
}
		



Measured memory_bytes: 188800