#include <bits/stdc++.h>
using namespace std;
int kmp[1000010];
int la, lb, j;
char a[1000010], b[1000010];
int n, m;
int k[1000010], k2[1000010];
long long ans;
int vis[1000010];
long long mod = 1e9 + 7;
long long qpow(long long a1, long long b1) {
  long long res = 1;
  while (b1) {
    if (b1 & 1) res = res * a1 % mod;
    a1 = a1 * a1 % mod;
    b1 >>= 1;
  }
  return res;
}
int main() {
  cin >> n >> m;
  cin >> b + 1;
  for (int i = 1; i <= m; i++) scanf("%d", &k[i]);
  for (int i = 2; i <= m; i++) {
    k2[i] = k[i] - k[i - 1];
  }
  lb = strlen(b + 1);
  for (int i = 2; i <= lb; i++) {
    while (j && b[i] != b[j + 1]) j = kmp[j];
    if (b[i] == b[j + 1]) j++;
    kmp[i] = j;
  }
  j = lb;
  while (j) {
    vis[j] = 1;
    j = kmp[j];
  }
  if (!m) {
    cout << qpow(26, n) << endl;
    return 0;
  }
  for (int i = 1; i <= m; i++) {
    if (k[i] + lb - 1 > n) {
      cout << 0;
      return 0;
    }
    if (i > 1 && k[i] - k[i - 1] < lb) {
      int x = k[i - 1] + lb - k[i];
      if (!vis[x]) {
        cout << 0;
        return 0;
      }
    }
  }
  int cnt = k[1] - 1;
  for (int i = 1; i < m; i++) {
    if (k[i] + lb < k[i + 1]) {
      cnt += k[i + 1] - k[i] - lb;
    }
  }
  cnt += n - k[m] - lb + 1;
  cout << qpow(26, cnt) << endl;
}
