#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e6 + 100;
const int base = 1e9 + 7;
int n, m, len;
char s[maxN];
int a[maxN], z[maxN];
int d[maxN * 2];
void hamz() {
  z[0] = 0;
  for (int i = 1, l = 0, r = 0; i < len; i++) {
    if (i <= r) z[i] = min(z[i - l], r - i + 1);
    while (i + z[i] < len && s[z[i]] == s[z[i] + i]) ++z[i];
    if (i + z[i] - 1 > r) {
      l = i;
      r = i + z[i] - 1;
    }
  }
}
int main() {
  scanf("%i %i\n", &m, &n);
  scanf("%s\n", s);
  for (int i = 0; i < n; i++) scanf("%i", &a[i]);
  len = strlen(s);
  hamz();
  int pre = a[0];
  bool ok = true;
  for (int i = 1; i < n; i++) {
    if (a[i] - pre < len) {
      if (z[a[i] - pre] != (len - (a[i] - pre))) ok = false;
    }
    pre = a[i];
  }
  if (!ok)
    cout << 0;
  else {
    for (int i = 0; i < n; i++) ++d[a[i]], --d[a[i] + len];
    for (int i = 1; i < m + 1; i++) d[i] += d[i - 1];
    long long res = 1;
    for (int i = 1; i < m + 1; i++)
      if (d[i] == 0) res = (res * 26) % base;
    cout << res;
  }
  fclose(stdin);
  return 0;
}
