#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
char s[maxn], tmp[maxn];
long long mod = 1e9 + 7;
int Next[maxn];
void getNext(char *tmp) {
  int len = strlen(tmp);
  Next[0] = -1;
  int k = -1;
  int j = 0;
  while (j < len) {
    if (k == -1 || tmp[j] == tmp[k]) {
      ++k;
      ++j;
      Next[j] = k;
    } else {
      k = Next[k];
    }
  }
}
int q[maxn];
vector<int> v;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  scanf("%s", tmp);
  getNext(tmp);
  int lent = strlen(tmp);
  int cur = lent;
  while (cur) {
    v.push_back(Next[cur]);
    cur = Next[cur];
  }
  sort(v.begin(), v.end());
  int la = -1;
  bool f = true;
  for (int i = 1; i <= m; i++) {
    scanf("%d", &q[i]);
    if (la < q[i]) {
      int c = 0;
      la = q[i] + 1;
      for (la = q[i] - 1, c = 0; c < lent; c++) {
        la++;
        s[la] = tmp[c];
      }
    } else {
      int tt = la - q[i] + 1;
      int pos = lower_bound(v.begin(), v.end(), tt) - v.begin();
      if (pos >= v.size() || v[pos] != tt) f = false;
      int c = 0;
      for (c = tt; c < lent; c++) {
        la++;
        s[la] = tmp[c];
      }
    }
  }
  if (!f) {
    cout << 0;
    return 0;
  }
  long long ans = 1;
  for (int i = 1; i <= n; i++)
    if (s[i] == 0) ans = (ans * 26ll) % mod;
  cout << ans;
}
