#include <bits/stdc++.h>
using namespace std;
const int md = 1e9 + 7;
int n, m;
char s[1000010];
int ps[1000010];
int a[1000010];
int z[1000010];
void calcZ(char* s, int* z) {
  int n = strlen(s);
  int mxr = 1;
  int mxl = 1;
  for (int i = 1; i < n; i++) {
    int cur = max(0, min(z[i - mxl], mxr - i));
    while (s[cur] == s[i + cur]) {
      cur++;
      mxl = i;
      mxr = i + cur;
    }
    z[i] = cur;
  }
}
int main() {
  scanf("%d %d", &n, &m);
  scanf("%s", s);
  int k = strlen(s);
  for (int i = 0; i < m; i++) {
    scanf("%d", &ps[i]);
    ps[i]--;
    a[ps[i]]++;
    a[ps[i] + k]--;
  }
  calcZ(s, z);
  for (int i = 0; i < m - 1; i++) {
    if (ps[i] + k <= ps[i + 1]) continue;
    int len = ps[i + 1] - ps[i];
    if (len + z[len] != k) {
      printf("0\n");
      return 0;
    }
  }
  int cc = 0;
  int ans = 1;
  for (int i = 0; i < n; i++) {
    cc += a[i];
    if (cc == 0) {
      ans = ((long long)ans * 26) % md;
    }
  }
  printf("%d\n", ans);
  return 0;
}
