#include <bits/stdc++.h>
using namespace std;
const int B = 128;
const int MOD = 1000000007;
int seq[1000000];
int powers[1000000];
int prefix[1000000];
int suffix[1000000];
void hashPrefix(const string &str) {
  int h = 0;
  for (int i = 0; i < ((int)(str).size()); ++i) {
    h = (((1ll * h * B) % MOD) + str[i]) % MOD;
    prefix[i] = h;
  }
}
void hashSuffix(const string &str) {
  int h = 0;
  for (int i = ((int)(str).size()) - 1, j = 0; i >= 0; --i, ++j) {
    h = (h + (1ll * powers[j] * str[i]) % MOD) % MOD;
    suffix[i] = h;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  int n, p;
  cin >> n >> p;
  string str;
  cin >> str;
  powers[0] = 1;
  for (int i = 1; i < ((int)(str).size()); ++i) {
    powers[i] = (1ll * powers[i - 1] * B) % MOD;
  }
  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) % MOD;
      }
    }
    cout << ans << '\n';
  }
  return 0;
}
