#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;
//#define int long long

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
inline int mul(int x, int y) { return (1LL*x*y)%MOD; }
inline void add(int &x, int v) { x += v; if (x >= MOD) x -= MOD; }

int fact[25001], fact_inv[25001];
int modpow(int x, int k) {
  int a = 1;
  while (k) {
    if (k&1) a = mul(a, x);
    x = mul(x, x);
    k >>= 1;
  }
  return a;
}
int nCr(int n, int r) {
  return mul(mul(fact[n], fact_inv[r]), fact_inv[n-r]);
}

int dp[30000][400][2][2];

vector<int> solve(int K, int iv, int M) {
  const int N = 25000 + iv;
  if (M != -1) assert(iv == 0);
  assert(M < K);
  assert(iv < K);

  rep(i, N+1) rep(j, K) rep(k, 2) rep(l, 2) dp[i][j][k][l] = 0;
  dp[0][iv][0][0] = 1;
  rep(i, N) rep(s, 2) rep(m, 2) {
    // K
    rep(j, K) add(dp[i+1][K-1][s^1][m], mul(dp[i][j][s][m], fact[K-j]));
    // none
    rep(j, K) if (j > 0) add(dp[i+1][j-1][s][m], dp[i][j][s][m]);
    add(dp[i+1][0][s][m], mul(dp[i][0][s][m], K));

    if (M != -1 && m == 0) {
      // K&M
      rep(j, K) add(dp[i+1][K-1][s^1][1], mul(dp[i][j][s][m], fact[K-j]));
      rep(j, K) {
        if (j >= M) {
          add(dp[i+1][j-1][s][1], dp[i][j][s][m]);
        }
        else {
          add(dp[i+1][M-1][s][1], mul(dp[i][j][s][m], mul(nCr(K-j, M-j), fact[M-j])));
        }
      }
    }
  }
  vector<int> ret(N+1, 0);
  int m = (M != -1);
  rep(i, N+1) {
    rep(s, 2) add(ret[i], mul(dp[i][0][s][m], s?(MOD-1):1));
  }
  reverse(all(ret));
  rep(i, iv) ret.pop_back();
  reverse(all(ret));
  return ret;
}

int N, K, M;
int A[25000];
bool used[400];

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  fact[0] = 1;
  for (int i=1; i<=25000; i++) fact[i] = mul(fact[i-1], i);
  for (int i=0; i<=25000; i++) fact_inv[i] = modpow(fact[i], MOD-2);

  cin >> N >> K >> M;
  rep(i, M) cin >> A[i], A[i]--;
  vector<int> values;
  rep(i, M) values.pb(A[i]);
  sort(all(values)); uniq(values);

  bool contains_uniq = false;
  rep(offset, M-K+1) {
    bool ok = true;
    rep(i, K) used[i] = false;
    rep(i, K) {
      int a = A[offset+i];
      if (used[a]) ok = false;
      used[a] = true;
    }
    if (ok) contains_uniq = true;
  }

  if (contains_uniq) {
    int s = N-M+1;
    rep(_, N-M) s = mul(s, K);
    cout << s << "\n";
  }
  else if (M < K && values.size() == M) {
    int all = N-M+1;
    rep(_, N-M) all = mul(all, K);
    int e = mul(nCr(K, M), fact[M]);
    int d = mul(solve(K, 0, M)[N], modpow(e, MOD-2));
    add(all, MOD-d);
    cout << all << "\n";
  }
  else {
    int left = 0, right = 0;
    rep(i, K) used[i] = false;
    rep(i, K) {
      assert(i < M);
      if (used[A[i]]) break;
      used[A[i]] = true;
      left++;
    }

    rep(i, K) used[i] = false;
    rep(i, K) {
      assert(i < M);
      if (used[A[M-1-i]]) break;
      used[A[M-1-i]] = true;
      right++;
    }
    vector<int> dpL = solve(K, left, -1);
    vector<int> dpR = solve(K, right, -1);
    int s = N-M+1;
    rep(_, N-M) s = mul(s, K);

    rep(l, N-M+1) {
      int r = N-M-l;
      add(s, MOD-mul(dpL[l], dpR[r]));
    }
    cout << s << "\n";
  }
  return 0;
}


Measured memory_bytes: 160256