You are given integers N, K, and an integer sequence A of length M.

An integer sequence where each element is between 1 and K (inclusive) is said to be colorful when there exists a contiguous subsequence of length K of the sequence that contains one occurrence of each integer between 1 and K (inclusive).

For every colorful integer sequence of length N, count the number of the contiguous subsequences of that sequence which coincide with A, then find the sum of all the counts. Here, the answer can be extremely large, so find the sum modulo 10^9+7.

Constraints

* 1 \leq N \leq 25000
* 1 \leq K \leq 400
* 1 \leq M \leq N
* 1 \leq A_i \leq K
* All values in input are integers.

Input

Input is given from Standard Input in the following format:


N K M
A_1 A_2 ... A_M


Output

For every colorful integer sequence of length N, count the number of the contiguous subsequences of that sequence which coincide with A, then print the sum of all the counts modulo 10^9+7.

Examples

Input

3 2 1
1


Output

9


Input

4 2 2
1 2


Output

12


Input

7 4 5
1 2 3 1 2


Output

17


Input

5 4 3
1 1 1


Output

0


Input

10 3 5
1 1 2 3 3


Output

1458


Input

25000 400 4
3 7 31 127


Output

923966268


Input

9954 310 12
267 193 278 294 6 63 86 166 157 193 168 43


Output

979180369
#include <bits/stdc++.h>
#define meow(args...) fprintf(stderr, args)
typedef unsigned u32;
typedef long long s64;
typedef unsigned long long u64;
template<class T1, class T2> inline bool cmin(T1 &a, const T2 &b) {return b<a?(a=b, true):false;}
template<class T1, class T2> inline bool cmax(T1 &a, const T2 &b) {return a<b?(a=b, true):false;}
template<class Type> Type read() {
	Type a;
	bool b;
	unsigned char c;
	while(c=getchar()-48, (c>9)&(c!=253));
	for(a=(b=c==253)?0:c; (c=getchar()-48)<=9; a=a*10+c);
	return b?-a:a;
}
int (*rd)()=read<int>;
const u32 P=1e9+7;
inline u32 &inc(u32 &a, u32 b) {return (a+=b)<P?a:(a-=P);}
inline u32 &dec(u32 &a, u32 b) {return (a-=b)&0x80000000?(a+=P):a;}
inline u32 sum(u32 a, u32 b) {return (a+=b)<P?a:a-P;}
inline u32 dif(u32 a, u32 b) {return (a-=b)&0x80000000?a+P:a;}
u64 power(u64 a, int b) {
	u64 ans=1;
	for(; b; a=a*a%P, b/=2) if(b&1) ans=ans*a%P;
	return ans;
}

const int N=25000, K=401;
int n, k, m, a[N], cnt[K];
u32 f[N], g[N], h[K];
void dp(u32 *res, int j0) {
	memset(h, 0, 4*k);
	h[j0]=res[0]=1;
	for(int i=1; i<=n-m; ++i) {
		u32 s=0;
		for(int j=k; --j; ) inc(res[i], h[j]=((k-j+1llu)*h[j-1]+inc(s, h[j]))%P);
	}
}
int main() {
	int pre, suf;
	u32 ans;
	n=rd(), k=rd(), m=rd();
	std::generate(a, a+m, rd);
	ans=power(k, n-m)*(n-m+1)%P;
	for(int i=0, tot=0; i<m; ++i) {
		if(++cnt[a[i]]==1) ++tot;
		if(i>=k&&--cnt[a[i-k]]==0) --tot;
		if(tot==k) {
			printf("%u\n", ans);
			return 0;
		}
	}
	memset(cnt+1, 0, k*sizeof(int));
	for(pre=0; pre<m&&++cnt[a[pre]]==1; ++pre);
	if(pre==m) {
		u32 sub=0;
		f[0]=1;
		for(int i=1; i<=n; ++i) {
			u32 s=0;
			for(int j=k; --j; ) f[j]=((k-j+1llu)*f[j-1]+inc(s, f[j]))%P;
			s=f[0]=0;
			for(int j=k; --j; ) g[j]=((k-j+1llu)*g[j-1]+inc(s, g[j]))%P;
			for(int j=m; j<k; ++j) inc(g[j], f[j]);
		}
		for(int i=1; i<k; ++i) inc(sub, g[i]);
		for(int i=0; i<m; ++i) sub=sub*power(k-i, P-2)%P;
		printf("%u\n", dif(ans, sub));
		return 0;
	}
	memset(cnt+1, 0, k*sizeof(int));
	for(suf=m; ++cnt[a[suf-1]]==1; --suf);
	dp(f, pre);
	dp(g, m-suf);
	for(int i=0; i<=n-m; ++i) ans=(ans+(u64)(P-f[i])*g[n-m-i])%P;
	printf("%u\n", ans);
	return 0;
}
