#include <bits/stdc++.h>
using namespace std;
const int N = 1000010;
const unsigned long long mod = 1000000007;
int n, m, len, cnt;
long long kq = 1;
int x[N], a[N], nex[N];
bool dd[N];
string p;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  cin >> p;
  len = p.size();
  p = " " + p;
  for (int i = 1; i <= m; ++i) cin >> x[i];
  for (int i = 2; i <= len; ++i) {
    int j = nex[i - 1];
    while (j && p[i] != p[j + 1]) j = nex[j];
    if (p[i] == p[j + 1]) j++;
    nex[i] = j;
  }
  int j = len;
  while (j) {
    dd[j] = true;
    j = nex[j];
  }
  x[m + 1] = n + 1;
  x[0] = -len + 1;
  for (int i = 1; i <= m + 1; ++i) {
    if (x[i] > x[i - 1] + len - 1)
      cnt += x[i] - x[i - 1] - len;
    else {
      int tg = x[i - 1] + len - x[i];
      if (!dd[tg]) {
        cout << 0;
        return 0;
      }
    }
  }
  for (int i = 1; i <= cnt; ++i) kq = (kq * 26) % mod;
  cout << kq;
}
