#include <bits/stdc++.h>
using namespace std;
int lps[1000005];
bool A[1000005];
long long pwr[1000005];
void LPS(string pat) {
  int len = 0, i = 1, M = pat.length();
  lps[0] = 0;
  while (i < M) {
    if (pat[i] == pat[len]) {
      len++;
      lps[i] = len;
      i++;
    } else {
      if (len != 0)
        len = lps[len - 1];
      else {
        lps[i] = 0;
        i++;
      }
    }
  }
  len = lps[M - 1];
  while (len) {
    A[len] = true;
    len = lps[len - 1];
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m, i, pre = 0, y, res = 0;
  bool flag = true;
  string p;
  for (i = pwr[0] = 1; i <= 1000000; i++)
    pwr[i] = (pwr[i - 1] * 26) % 1000000007;
  cin >> n >> m >> p;
  LPS(p);
  while (m--) {
    cin >> y;
    if (y > pre)
      res += y - pre - 1;
    else
      flag &= A[pre - y + 1];
    pre = y + (int)p.size() - 1;
  }
  res += n - pre;
  if (flag)
    cout << pwr[res];
  else
    cout << 0;
  return 0;
}
