#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
const int H[2] = {37, 41};
const int M[2] = {(int)1e9 + 7, (int)1e9 + 9};
int y[N];
pair<long long, long long> pre_hash[N], suf_hash[N];
bool valid[N];
int main() {
  int n, m, i, j;
  cin >> n >> m;
  string p;
  cin >> p;
  for (i = 0; i < m; ++i) cin >> y[i];
  long long hash[2] = {H[0], H[1]};
  pre_hash[0] = {H[0] * p[0], H[1] * p[0]};
  suf_hash[0] = {H[0] * p.back(), H[1] * p.back()};
  for (i = 1; i < p.size(); ++i) {
    for (j = 0; j < 2; ++j) hash[j] = (hash[j] * H[j]) % M[j];
    pre_hash[i] = {(pre_hash[i - 1].first + p[i] * hash[0] % M[0]) % M[0],
                   (pre_hash[i - 1].second + p[i] * hash[1] % M[1]) % M[1]};
    suf_hash[i] = {(suf_hash[i - 1].first * H[0] % M[0] +
                    p[p.size() - i - 1] * H[0] % M[0]) %
                       M[0],
                   (suf_hash[i - 1].second * H[1] % M[1] +
                    p[p.size() - i - 1] * H[1] % M[1]) %
                       M[1]};
  }
  for (i = 0; i < p.size(); ++i) valid[i] = pre_hash[i] == suf_hash[i];
  for (i = 0; i < m - 1; ++i)
    if (y[i + 1] < y[i] + p.size() && !valid[y[i] + p.size() - y[i + 1] - 1]) {
      cout << "0\n";
      return 0;
    }
  int cnt = 0;
  if (m > 1) {
    for (i = 0; i < m; ++i)
      if (y[i + 1] >= y[i] + p.size()) cnt += y[i + 1] - y[i] - p.size();
    cnt += y[0] - 1 + n - (y[m - 1] + p.size()) + 1;
  } else if (m == 1) {
    cnt = n - p.size();
  } else
    cnt = n;
  long long ans = 1;
  for (i = 0; i < cnt; ++i) ans = (ans * 26) % M[0];
  cout << ans << '\n';
  return 0;
}
