#include <bits/stdc++.h>
using namespace std;
char p[1000010];
long long h11[1000010], h12[1000010], h21[1000010], h22[1000010];
long long pow1(long long a, long long b) {
  if (b == 0) return 1;
  if (b == 1) return a;
  long long ret = pow1(a, b / 2);
  ret = (ret * ret) % 1000000007;
  if (b & 1) ret = (ret * a) % 1000000007;
  return ret;
}
int main() {
  int n, m, l, i, y, maxx = 0, c = 0;
  bool f = 0;
  long long prod1, prod2;
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%s", &p);
  l = strlen(p);
  h11[0] = p[0] - 'a';
  h12[0] = p[0] - 'a';
  for (i = 1; i < l; ++i) {
    h11[i] = (h11[i - 1] * 29 + p[i] - 'a') % 1000000007;
    h12[i] = (h12[i - 1] * 29 + p[i] - 'a') % 1000000009;
  }
  prod1 = prod2 = 29;
  h21[l - 1] = p[l - 1] - 'a';
  h22[l - 1] = p[l - 1] - 'a';
  for (i = l - 2; i >= 0; --i) {
    h21[i] = ((p[i] - 'a') * prod1 + h21[i + 1]) % 1000000007;
    h22[i] = ((p[i] - 'a') * prod2 + h22[i + 1]) % 1000000009;
    prod1 = (prod1 * 29) % 1000000007;
    prod2 = (prod2 * 29) % 1000000009;
  }
  for (i = 0; i < m; ++i) {
    scanf("%d", &y);
    if (y > maxx) {
      c = c + y - maxx - 1;
      maxx = y + l - 1;
    } else {
      if (!(h11[maxx - y] == h21[l + y - maxx - 1] &&
            h12[maxx - y] == h22[l + y - maxx - 1])) {
        f = 1;
      }
      maxx = y + l - 1;
    }
  }
  c = c + n - maxx;
  if (!f) {
    printf("%lld\n", pow1(26, c));
  } else
    printf("%d\n", 0);
}
