#include <bits/stdc++.h>
using namespace std;
inline vector<int> prefix(string p) {
  vector<int> pi;
  int m = p.size();
  for (int(i) = (0); (i) < (m); ++(i)) pi.push_back(-1);
  int k = -1;
  for (int(i) = (1); (i) < (m); ++(i)) {
    while (k != -1 && p[k + 1] != p[i]) k = pi[k];
    if (p[k + 1] == p[i]) k++;
    pi[i] = k;
  }
  return pi;
}
set<int> s;
inline void shift(string p) {
  vector<int> pi = prefix(p);
  int m = p.size();
  int k = pi[m - 1];
  while (k != -1) {
    s.insert(m - k);
    k = pi[k];
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  long long n, m;
  cin >> n >> m;
  string p;
  cin >> p;
  vector<int> pi = prefix(p);
  shift(p);
  vector<int> v;
  for (int(i) = (0); (i) < (m); ++(i)) {
    int a;
    cin >> a;
    v.push_back(a);
  }
  bool ok = true;
  for (int(i) = (1); (i) < (v.size()); ++(i)) {
    long long r = v[i], l = v[i - 1];
    if (r < (l + p.size()) && s.find((r - l + 1)) == s.end()) {
      cout << 0 << endl;
      ok = false;
      break;
    }
    if ((p.size() + r - 1) > n && ok) {
      cout << 0 << endl;
      ok = false;
      break;
    }
  }
  long long first = n;
  if (ok) {
    v.push_back(2000000000);
    for (int(i) = (0); (i) < (v.size() - 1); ++(i))
      first -= min((int)p.size(), v[i + 1] - v[i]);
  }
  long long ans = 1;
  if (first < 0 && ok) {
    cout << 0 << endl;
    ok = false;
  }
  for (int(i) = (0); (i) < (first); ++(i))
    ans = (ans * (long long)26) % 1000000007;
  if (ok) cout << ans << endl;
}
