#include <bits/stdc++.h>
using namespace std;
int n, m;
const int MAXN = 1e6 + 5;
int y[MAXN];
long long M = 1e9 + 7;
vector<int> zfunction(string& s) {
  int n = s.length();
  vector<int> z(n);
  for (int i = 1, l = 0, r = 0; i < n; i++) {
    if (i <= r) {
      z[i] = min(r - i + 1, z[i - l]);
    }
    while (i + z[i] < n && s[z[i]] == s[i + z[i]]) {
      z[i]++;
    }
    if (r < i + z[i] - 1) {
      l = i;
      r = i + z[i] - 1;
    }
  }
  z[0] = n;
  return z;
}
int main() {
  cin >> n >> m;
  string p;
  cin >> p;
  vector<int> z = zfunction(p);
  for (int i = 0; i < m; i++) {
    cin >> y[i];
    y[i]--;
  }
  int pl = p.length();
  int used = 0;
  int r = -1;
  bool ok = true;
  for (int i = 0; i < m; i++) {
    if (r < y[i]) {
      used += pl;
      r = y[i] + pl - 1;
    } else {
      int rep = r - y[i] + 1;
      if (z[pl - rep] == rep) {
        used += (pl - rep);
        r = y[i] + pl - 1;
      } else {
        ok = false;
        break;
      }
    }
  }
  if (!ok) {
    cout << 0 << endl;
  } else {
    long long res = 1;
    int free = n - used;
    for (int i = 0; i < free; i++) {
      res = (res * 26L) % M;
    }
    cout << res << endl;
  }
}
