#include<bits/stdc++.h>

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;

struct Combination {
  int mod;
  vector< int64_t > mfact, rfact;

  Combination(int sz, int mod) : mfact(sz + 1), rfact(sz + 1), mod(mod) {
    mfact[0] = 1;
    for(int i = 1; i < mfact.size(); i++) {
      mfact[i] = mfact[i - 1] * i % mod;
    }
    rfact[sz] = inv(mfact[sz]);
    for(int i = sz - 1; i >= 0; i--) {
      rfact[i] = rfact[i + 1] * (i + 1) % mod;
    }
  }

  int64_t fact(int k) const {
    return (mfact[k]);
  }

  int64_t pow(int64_t x, int64_t n) const {
    int64_t ret = 1;
    while(n > 0) {
      if(n & 1) (ret *= x) %= mod;
      (x *= x) %= mod;
      n >>= 1;
    }
    return (ret);
  }

  int64_t inv(int64_t x) const {
    return (pow(x, mod - 2));
  }

  int64_t P(int n, int r) const {
    if(r < 0 || n < r) return (0);
    return (mfact[n] * rfact[n - r] % mod);
  }

  int64_t C(int p, int q) const {
    if(q < 0 || p < q) return (0);
    return (mfact[p] * rfact[q] % mod * rfact[p - q] % mod);
  }

  int64_t H(int n, int r) const {
    if(n < 0 || r < 0) return (0);
    return (r == 0 ? 1 : C(n + r - 1, r));
  }
};

int dp[25001][2][401];

int main() {
  int N, K, M, A[25000];
  cin >> N >> K >> M;

  for(int i = 0; i < M; i++) {
    cin >> A[i];
  }


  bool distinct = true;
  {
    bool used[401] = {};
    for(int i = 0; i < M; i++) {
      if(used[A[i]]) distinct = false;
      used[A[i]] = true;
    }
  }

  bool colorful = false;
  {
    for(int i = 0; i <= M - K; i++) {
      bool used[401] = {};
      bool f = true;
      for(int j = 0; j < K; j++) {
        if(used[A[i + j]]) f = false;
        used[A[i + j]] = true;
      }
      colorful |= f;
    }
  }

  int64 all = N - M + 1;
  for(int i = 0; i < N - M; i++) (all *= K) %= mod;

  if(colorful) {
    cout << all << endl;
    return 0;
  }

  Combination beet(101010, mod);
  if(distinct) {
    dp[0][0][0] = 1;
    for(int i = 0; i < N; i++) {
      for(int _ = 0; _ < 2; _++) {
        int sum = 0;
        for(int j = K - 1; j >= 0; j--) {
          int64 add = 1LL * dp[i][_][j] * (K - j) % mod;
          (dp[i + 1][_][j + 1] += add) %= mod;
          if(!_ && j + 1 >= M) (dp[i + 1][1][j + 1] += add) %= mod;
          if(j) {
            (sum += dp[i][_][j]) %= mod;
            (dp[i + 1][_][j] += sum) %= mod;
            if(!_ && j >= M) (dp[i + 1][1][j] += sum) %= mod;
          }
        }
      }
    }
    int64 ret = 0;
    for(int i = 0; i < K; i++) (ret += dp[N][1][i]) %= mod;
    for(int i = 0; i < M; i++) (ret *= beet.inv(K - i)) %= mod;
    cout << (all + mod - ret) % mod << endl;
    return 0;
  }

  int u = 0, v = 0;
  {
    bool used[401] = {};
    for(int i = 0; i < M; i++) {
      if(used[A[i]]) break;
      used[A[i]] = true;
      ++u;
    }
  }
  {
    bool used[401] = {};
    for(int i = M - 1; i >= 0; i--) {
      if(used[A[i]]) break;
      used[A[i]] = true;
      ++v;
    }
  }

  dp[0][0][u] = 1;
  dp[0][1][v] = 1;

  for(int i = 0; i < N; i++) {
    for(int _ = 0; _ < 2; _++) {
      int sum = 0;
      for(int j = K - 1; j >= 0; j--) {
        int64 add = 1LL * dp[i][_][j] * (K - j) % mod;
        (dp[i + 1][_][j + 1] += add) %= mod;
        if(j) {
          (sum += dp[i][_][j]) %= mod;
          (dp[i + 1][_][j] += sum) %= mod;
        }
      }
    }
  }

  int64 ret = 0;
  for(int i = 0; i <= N - M; i++) {
    int64 s = 0, t = 0;
    for(int j = 1; j < K; j++) {
      (s += dp[i][0][j]) %= mod;
      (t += dp[N - M - i][1][j]) %= mod;
    }
    ret += s * t % mod;
    ret %= mod;
  }
  cout << (all + mod - ret) % mod << endl;
}

Measured memory_bytes: 80256