#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7, A = 1e6 + 5, base = 31, base2 = 37;
long long mul(long long a, long long b) {
  return ((a % mod) * (b % mod)) % mod;
}
long long add(long long a, long long b) {
  return ((a % mod) + (b % mod) + mod) % mod;
}
long long fp(long long x, long long y) {
  if (!y) return 1;
  long long acc = fp(x, y / 2) % mod;
  acc = mul(acc, acc);
  return y & 1 ? mul(acc, x) : acc;
}
pair<long long, long long> pref[A];
long long inv[A], inv2[A], pw[A], pw2[A];
void pre() {
  pw[0] = pw2[0] = inv[0] = inv2[0] = 1;
  long long pw_inv = fp(base, mod - 2);
  long long pw_inv2 = fp(base2, mod - 2);
  for (int i = 1; i < A; i++) {
    pw[i] = mul(pw[i - 1], base);
    pw2[i] = mul(pw2[i - 1], base2);
    inv[i] = mul(inv[i - 1], pw_inv);
    inv2[i] = mul(inv2[i - 1], pw_inv2);
  }
}
pair<long long, long long> get_hash(long long l, long long r) {
  long long ret = mul(add(pref[r].first, (l ? -pref[l - 1].first : 0)), inv[l]);
  long long ret2 =
      mul(add(pref[r].second, (l ? -pref[l - 1].second : 0)), inv2[l]);
  return {ret, ret2};
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, m;
  string s;
  cin >> n >> m >> s;
  int a[m];
  pre();
  for (int i = 0; i < (int)s.size(); i++) {
    pref[i].first =
        add(mul(s[i] - 'a' + 1, pw[i]), (i ? pref[i - 1].first : 0));
    pref[i].second =
        add(mul(s[i] - 'a' + 1, pw2[i]), (i ? pref[i - 1].second : 0));
  }
  for (int i = 0; i < m; i++) {
    cin >> a[i], a[i]--;
    if (i) {
      int sz = s.size(), len = a[i - 1] + sz - 1;
      if (len >= a[i]) {
        int x = len - a[i];
        pair<long long, long long> suff = get_hash(sz - 1 - x, sz - 1);
        if (suff.first != pref[x].first || suff.second != pref[x].second)
          return cout << 0, 0;
      }
      if (len > n) return cout << 0, 0;
    }
  }
  long long ans = 1;
  int rem = 0, p1 = 0;
  for (int i = 0; i < n; i++) {
    if (p1 < m && a[p1] == i)
      rem = (int)s.size() - 1, p1++;
    else
      rem ? rem-- : ans = mul(ans, 26);
  }
  cout << ans;
  return 0;
}
