#include <bits/stdc++.h>
using namespace std;
string a, b;
int Next[1000005];
int n, m;
int main() {
  scanf("%d%d", &n, &m);
  cin >> b;
  int len = b.length();
  string c(n, '?');
  a = c;
  memset(Next, -1, sizeof(Next));
  int i, j;
  for (i = 1; i < len; i++) {
    j = Next[i - 1];
    while ((b[j + 1] != b[i]) && (j >= 0)) j = Next[j];
    if (b[j + 1] == b[i]) Next[i] = j + 1;
  }
  i = 0;
  j = 0;
  int t = 0;
  int pt;
  for (t = 0; t < m; t++) {
    scanf("%d", &pt);
    pt--;
    if (a[pt] != '?' && a[pt] != b[0]) {
      printf("0\n");
      return 0;
    }
    if (t == 0 || pt > i) {
      i = pt;
      j = 0;
    } else {
      if (Next[len - 1] + 1 >= i - pt) {
        j = i - pt;
      } else {
        printf("0\n");
        return 0;
      }
    }
    for (j; j < len; j++) {
      if (a[i] != '?' && a[i] != b[j]) {
        printf("0\n");
        return 0;
      }
      a[i++] = b[j];
    }
  }
  long long ans = 1;
  for (int i = 0; i < n; i++) {
    if (a[i] == '?') ans *= 26;
    ans %= 1000000007;
  }
  printf("%lld\n", ans);
  return 0;
}
