#include <bits/stdc++.h>
using namespace std;
void compute(string pat, int M, int *lps) {
  int len = 0;
  int i = 1;
  lps[0] = 0;
  while (i < M) {
    if (pat[i] == pat[len])
      lps[i++] = ++len;
    else if (len != 0)
      len = lps[len - 1];
    else
      lps[i++] = 0;
  }
}
int main() {
  int n, m, cur = 0, ans = 0;
  cin >> n >> m;
  long long pow[n + 1];
  pow[0] = 1;
  for (__typeof(n + 1) i = (1) - ((1) > (n + 1));
       i != (n + 1) - ((1) > (n + 1)); i += 1 - 2 * ((1) > (n + 1)))
    pow[i] = (pow[i - 1] * 26) % 1000000007;
  string s;
  cin >> s;
  int lps[(int)((s).size())];
  compute(s, (int)((s).size()), lps);
  vector<bool> valid((int)((s).size()), false);
  valid[0] = true;
  cur = (int)((s).size()) - 1;
  while (lps[cur] > 0) {
    valid[(int)((s).size()) - lps[cur]] = true;
    cur = lps[cur] - 1;
  }
  cur = 0;
  int prev = -n, temp;
  for (int i = 0; i < m; i++) {
    cin >> temp;
    temp--;
    if (temp >= cur) {
      ans += (temp - cur);
      cur = temp + (int)((s).size());
    } else {
      if (!valid[temp - prev]) {
        cout << 0 << endl;
        return 0;
      }
      cur = temp + (int)((s).size());
    }
    prev = temp;
  }
  ans += (n - cur);
  cout << pow[ans] << endl;
  return 0;
}
