#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T &x) {
  x = 0;
  char ch = getchar();
  int fh = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') fh = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  x *= fh;
}
template <typename T>
void write(T x) {
  if (x < 0) x = -x, putchar('-');
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
template <typename T>
void writeln(T x) {
  write(x);
  puts("");
}
int n, m, len;
int ne[1000005];
char p[1000005];
int y[1000005];
bool can[1000005];
int cf[1000005];
int qpow(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a % 1000000007;
    a = a * a % 1000000007;
    b >>= 1;
  }
  return res;
}
signed main() {
  cin >> n >> m >> p + 1;
  len = strlen(p + 1);
  for (int i = 1; i <= m; ++i) cin >> y[i];
  for (int i = 2, j = 0; i <= len; ++i) {
    while (j && p[j + 1] != p[i]) j = ne[j];
    if (p[j + 1] == p[i]) ++j;
    ne[i] = j;
  }
  int cur = len;
  while (cur) {
    can[cur] = 1;
    cur = ne[cur];
  }
  bool flag = true;
  for (int i = 1; i <= m - 1; ++i)
    if (y[i] + len - y[i + 1] >= 1 && !can[y[i] + len - y[i + 1]]) {
      flag = false;
      break;
    }
  if (!flag) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 1; i <= m; ++i) {
    cf[y[i]]++;
    cf[y[i] + len]--;
  }
  int res = 0;
  for (int i = 1; i <= n; ++i) {
    cf[i] += cf[i - 1];
    if (cf[i] == 0) res++;
  }
  cout << qpow(26, res) << endl;
  return 0;
}
