#include <bits/stdc++.h>
using namespace std;
const int B1 = 256;
const int B2 = 128;
const int MOD1 = 2000000011;
const int MOD2 = 1000000007;
int seq[1000000];
int power1[1000000];
int power2[1000000];
pair<int, int> prefix[1000000];
pair<int, int> suffix[1000000];
void hashPrefix(const string &str) {
  int h1 = 0, h2 = 0;
  for (int i = 0; i < ((int)(str).size()); ++i) {
    h1 = (((1ll * h1 * B1) % MOD1) + str[i]) % MOD1;
    h2 = (((1ll * h2 * B2) % MOD2) + str[i]) % MOD2;
    prefix[i] = {h1, h2};
  }
}
void hashSuffix(const string &str) {
  int h1 = 0, h2 = 0;
  for (int i = ((int)(str).size()) - 1, j = 0; i >= 0; --i, ++j) {
    h1 = (h1 + (1ll * power1[j] * str[i]) % MOD1) % MOD1;
    h2 = (h2 + (1ll * power2[j] * str[i]) % MOD2) % MOD2;
    suffix[i] = {h1, h2};
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  int n, p;
  cin >> n >> p;
  string str;
  cin >> str;
  power1[0] = power2[0] = 1;
  for (int i = 1; i < ((int)(str).size()); ++i) {
    power1[i] = (1ll * power1[i - 1] * B1) % MOD1;
    power2[i] = (1ll * power2[i - 1] * B2) % MOD2;
  }
  hashPrefix(str);
  hashSuffix(str);
  bool good = true;
  for (int i = 0, j = 0; i < p; ++i) {
    cin >> seq[i];
    if (j && (seq[i] - j) < ((int)(str).size())) {
      if (suffix[seq[i] - j] !=
          prefix[((int)(str).size()) - (seq[i] - j) - 1]) {
        good = false;
      }
    }
    j = seq[i];
  }
  if (good == false) {
    cout << "0\n";
  } else {
    int ans = 1, covered = 0;
    for (int i = 1, j = 0; i <= n; ++i) {
      if (j < p && i == seq[j]) {
        covered = i + ((int)(str).size()) - 1;
        ++j;
      }
      if (i > covered) {
        ans = (ans * 26ll) % MOD2;
      }
    }
    cout << ans << '\n';
  }
  return 0;
}
