#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 5, MOD = 1e9 + 7;
int z[MAXN], N;
void Zvalue(string s) {
  z[0] = s.size();
  int l = 0, r = 0, x;
  for (int i = 1; i < s.size(); i++) {
    if (r < i || z[i - l] >= r - i + 1) {
      r < i ? x = i : x = r + 1;
      while (x < s.size() && s[x] == s[x - i]) x++;
      z[i] = x - i;
      if (i < x) {
        l = i;
        r = x - 1;
      }
    } else
      z[i] = z[i - l];
  }
}
string s;
int pos[MAXN];
int ans[MAXN];
long long int exp(int x) {
  long long int ans = 1, tmp = 26;
  while (x) {
    if (x % 2) ans *= tmp;
    x /= 2;
    tmp = (tmp * tmp) % MOD;
    ans %= MOD;
  }
  return ans;
}
bool check(int x, int y) {
  if (y - x >= N)
    return true;
  else
    return z[y - x] >= x + N - y;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  if (m == 0) {
    cout << exp(n) << endl;
    return 0;
  }
  cin >> s;
  for (int i = 1; i <= m; i++) {
    cin >> pos[i];
    pos[i]--;
  }
  Zvalue(s);
  N = (int)s.size();
  for (int i = 1; i < m; i++) {
    if (check(pos[i], pos[i + 1])) {
      ans[pos[i]]++;
      ans[pos[i] + N]--;
    } else {
      cout << 0 << endl;
      return 0;
    }
  }
  ans[pos[m]]++;
  ans[pos[m] + N]--;
  for (int i = 1; i < n; i++) {
    ans[i] += ans[i - 1];
  }
  int total = 0;
  for (int i = 0; i < n; i++)
    if (!ans[i]) total++;
  cout << exp(total) << endl;
}
