#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e6 + 2;
const double EPS = 1e-11;
const int MOD = 1e9 + 7;
int n, m;
char p[MAX];
int z[MAX], N;
void Zfunction(char* str) {
  int L = 0, R = 0;
  for (int i = 0; i < N; i++) z[i] = 0;
  for (int i = 1; i < N; i++) {
    if (i <= R) z[i] = min(z[i - L], R - i + 1);
    while (i + z[i] < N && str[i + z[i]] == str[z[i]]) z[i]++;
    if (i + z[i] - 1 > R) L = i, R = i + z[i] - 1;
  }
}
int bb[MAX];
int main() {
  scanf("%d%d", &n, &m);
  scanf("%s", p);
  N = strlen(p);
  Zfunction(p);
  for (int i = 0; i < m; i++) {
    scanf("%d", &bb[i]);
    bb[i]--;
  }
  int ans = 0;
  bb[m] = n;
  for (int i = 0; i <= m; i++) {
    if (i == 0)
      ans = bb[i] - 0;
    else {
      if (bb[i - 1] + N < bb[i]) ans += bb[i] - (bb[i - 1] + N);
    }
  }
  int rans = 1;
  for (int i = 0; i < ans; i++) rans = ((long long)rans * 26) % MOD;
  bool pos = 1;
  for (int i = 1; i < m; i++) {
    if (bb[i - 1] + N > bb[i]) {
      int cur = bb[i - 1] + N - bb[i];
      cur = N - cur;
      if (z[cur] + cur < N) {
        pos = 0;
        break;
      }
    }
  }
  if (pos)
    printf("%d\n", rans);
  else
    printf("0\n");
}
