#include <bits/stdc++.h>
#define MAX_C 400
#define MAX_N 25000
#define P 1000000007
using namespace std;
typedef long long lnt;
template <class T> inline void read(T &x) {
	x = 0; int c = getchar(), f = 1;
	for (; !isdigit(c); c = getchar()) if (c == 45) f = -1;
	for (; isdigit(c); c = getchar()) (x *= 10) += f*(c-'0');
}
int n, m, c, a[MAX_N+5]; bool flag, mrk[MAX_C+5];
lnt f[MAX_N+5][MAX_C+5], g[MAX_N+5][MAX_C+5]; int lp, rp;
lnt Fac(int x) {
	lnt ret = 1;
	for (int i = 1; i <= x; i++)
		(ret *= i) %= P;
	return ret;
}
lnt Pow(lnt x, int k) {
	lnt ret = 1;
	for (; k; k >>= 1, x = x*x%P)
		if (k&1) ret = ret*x%P;
	return ret;
}
int main() {
	read(n), read(c), read(m);
	lnt tot = Pow(c, n-m)*(n-m+1)%P;
	for (int i = 1; i <= m; i++) read(a[i]);
	for (int l = 1; l+c-1 <= m; l++) {
		memset(mrk, false, sizeof mrk);
		for (int r = l; r <= l+c; r++)
			if (r == l+c) flag = true;
			else if (mrk[a[r]]) break;
			else mrk[a[r]] = true;
		if (flag) return printf("%lld\n", tot), 0;
	}
	memset(mrk, false, sizeof mrk);
	for (int i = 1; i <= m; i++)
		if (mrk[a[i]]) break;
		else mrk[a[i]] = true, lp++;
	memset(mrk, false, sizeof mrk);
	for (int i = m; i >= 1; i--)
		if (mrk[a[i]]) break;
		else mrk[a[i]] = true, rp++;
	if (lp == m && rp == m) {
		f[0][0] = 1;
		for (int i = 1; i <= n; i++) {
			lnt sf = 0, sg = 0;
			for (int j = c-1; j; j--) {
				(sf += f[i-1][j]) %= P, f[i][j] = (f[i-1][j-1]*(c-j+1)%P+sf)%P;
				(sg += g[i-1][j]) %= P, g[i][j] = (g[i-1][j-1]*(c-j+1)%P+sg)%P;
				if (j >= m) (g[i][j] += f[i][j]) %= P;
			}
		}
		lnt sum = 0;
		for (int i = 1; i < c; i++) (sum += g[n][i]) %= P;
		(tot += P-sum*Fac(c-m)%P*Pow(Fac(c), P-2)%P) %= P;
	} else {
		f[0][lp] = g[0][rp] = 1;
		for (int i = 1; i <= n; i++) {
			lnt sf = 0, sg = 0;
			for (int j = c-1; j; j--)
				(sf += f[i-1][j]) %= P, f[i][j] = (f[i-1][j-1]*(c-j+1)%P+sf)%P, 
				(sg += g[i-1][j]) %= P, g[i][j] = (g[i-1][j-1]*(c-j+1)%P+sg)%P;
		}
		for (int l = 0, r = n-m; l <= n-m && r >= 0; l++, r--) {
			lnt sf = 0, sg = 0;
			for (int i = 1; i < c; i++) (sf += f[l][i]) %= P;
			for (int i = 1; i < c; i++) (sg += g[r][i]) %= P;
			(tot += P-sf*sg%P) %= P;
		}
	}
	return printf("%lld\n", tot), 0;
}
