#include <bits/stdc++.h>
using namespace std;
char s[2000001];
int val[2000002];
int num[2000001];
int z[2000001];
int main() {
  int L = 0, R = 0;
  int m, n, i, j, sum;
  long long mul = 1;
  int p;
  scanf("%d %d", &n, &m);
  scanf("%s", s);
  sum = n;
  p = strlen(s);
  for (i = 0; i < m; i++) {
    scanf("%d", &num[i]);
  }
  for (int i = 1; i < p; i++) {
    if (i > R) {
      L = R = i;
      while (R < p && s[R - L] == s[R]) R++;
      z[i] = R - L;
      R--;
    } else {
      int k = i - L;
      if (z[k] < R - i + 1)
        z[i] = z[k];
      else {
        L = i;
        while (R < p && s[R - L] == s[R]) R++;
        z[i] = R - L;
        R--;
      }
    }
  }
  for (i = 0; i < m - 1; i++) {
    if (num[i + 1] - num[i] < p) {
      if (z[num[i + 1] - num[i]] != num[i] + p - num[i + 1]) {
        sum = -1;
      } else {
        sum -= num[i + 1] - num[i];
      }
    } else
      sum -= p;
  }
  if (m > 0) sum -= p;
  for (i = 1; i <= sum; i++) {
    mul *= 26;
    mul %= 1000000007;
  }
  if (sum >= 0)
    printf("%I64d\n", mul);
  else
    printf("0\n");
  return 0;
}
