#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
const int MAXN = 2 * 666666;
const int MOD = 1e9 + 7;
const int MOD1 = 1e9 + 35011;
const int MOD2 = 1e9 + 18169;
const int INF = (1 << 30);
const long long INFl = 1e18;
int n, m, nxt[MAXN], q[2 * MAXN], head = 0, tail = 0, pos = 0;
char p[MAXN];
vector<int> z_function(char s[]) {
  int n = strlen(s);
  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 (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;
  }
  return z;
}
int main() {
  scanf("%d%d\n", &n, &m);
  gets(p);
  for (size_t i = 0; i < m; ++i) scanf("%d", &nxt[i]);
  int len = strlen(p);
  vector<int> z = z_function(p);
  long long ans = 1;
  int cur = len;
  z.push_back(0);
  for (int i = 1; i <= n; ++i) {
    if (pos < n && i == nxt[pos]) {
      if (cur + z[cur] != len) {
        ans = 0;
      }
      cur = 0;
      pos++;
    }
    if (cur >= len) ans = (ans * 26) % MOD;
    cur = min(cur + 1, len);
  }
  printf("%I64d\n", ans);
  return 0;
}
