#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 4, mod = 1e9 + 7;
int y[N];
vector<int> computeP(string pat) {
  int m = pat.size();
  vector<int> ret(m);
  for (int i = 1, k = 0; i < m; ++i) {
    while (k > 0 && pat[k] != pat[i]) k = ret[k - 1];
    if (pat[k] == pat[i])
      ret[i] = ++k;
    else
      ret[i] = k;
  }
  return ret;
}
long long fp(long long base, long long power) {
  if (power == 0) return 1;
  if (power % 2 == 0) return fp((base * base) % mod, power / 2) % mod;
  return (base * fp((base * base) % mod, power / 2) % mod) % mod;
}
int main() {
  int n, m;
  string p;
  cin >> n >> m >> p;
  int sz = p.size();
  vector<int> v = computeP(p);
  for (int i = 0; i < m; ++i) {
    cin >> y[i];
  }
  if (!m) {
    cout << fp(26, n);
    return 0;
  }
  int maxi = v[v.size() - 1];
  vector<int> st;
  while (maxi) {
    st.push_back(maxi);
    maxi = v[maxi - 1];
  }
  sort(st.begin(), st.end());
  long long ans = y[0] - 1;
  if (n - y[m - 1] + 1 < sz) {
    cout << 0;
    return 0;
  }
  ans += (n - y[m - 1] - p.size() + 1);
  for (int i = 1; i < m; ++i) {
    int here = y[i];
    int pre = y[i - 1] + sz - 1;
    if (here <= pre) {
      int diff = y[i - 1] + sz - y[i];
      if (!binary_search(st.begin(), st.end(), diff)) {
        cout << 0;
        return 0;
      }
    } else {
      ans += (here - pre - 1);
    }
  }
  cout << fp(26, ans) % mod;
  return 0;
}
