#include <bits/stdc++.h>
using namespace std;
string pattern;
int f[1100000], pos[1100000];
bool valid[1100000];
int mod = 1e9 + 7;
long long mod_pow(long long base, long long exp) {
  if (exp == 0) return 1;
  if (exp == 1) return base;
  long long ans = mod_pow(base, exp / 2);
  ans = (ans * ans) % mod;
  if (exp & 1) ans = (ans * base) % mod;
  return ans;
}
void build_failure_function() {
  int n = pattern.size();
  f[0] = f[1] = 0;
  for (int i = 2; i <= n; i++) {
    int j = f[i - 1];
    while (1) {
      if (pattern[j] == pattern[i - 1]) {
        f[i] = j + 1;
        break;
      }
      if (j == 0) {
        f[i] = 0;
        break;
      }
      j = f[j];
    }
  }
}
int main() {
  int n, m;
  cin >> n >> m >> pattern;
  build_failure_function();
  int sz = pattern.size();
  while (sz) {
    valid[sz] = 1;
    sz = f[sz];
  }
  sz = pattern.size();
  pos[0] = -1 * sz + 1;
  int cnt = 0;
  bool ans = 1;
  for (int i = 1; i <= m; i++) {
    cin >> pos[i];
    if ((pos[i] >= pos[i - 1] + sz) && ans) {
      cnt += pos[i] - (pos[i - 1] + sz);
    } else {
      if (!valid[sz - (pos[i] - pos[i - 1])]) ans = 0;
    }
  }
  if (!ans)
    cout << "0";
  else {
    cnt += n + 1 - (pos[m] + sz);
    cout << mod_pow(26, cnt);
  }
}
