#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T maxer(T &a, T b) {
  a = max(a, b);
}
template <typename T>
inline T miner(T &a, T b) {
  a = min(a, b);
}
void iOS() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
void fin() { freopen("in", "r", stdin); }
void fout() { freopen("out", "w", stdout); }
const int inf = ~0u / 10;
const long long linf = ~0ull / 2;
const int maxn = 1e6 + 20, mod = 1e9 + 7, base = 709;
long long h[maxn], b[maxn], a[maxn];
bool g[maxn];
int subh(int l, int r) {
  return (h[r] - ((h[l] * b[r - l]) % mod) + mod) % mod;
}
int main() {
  iOS();
  long long n, m, ans = 0;
  cin >> n >> m;
  if (m == 0) {
    ans = 1;
    for (int i = 0; i < n; i++) ans = (ans * 26) % mod;
    return cout << ans, 0;
  }
  string p;
  cin >> p;
  for (int i = 0; i < m; i++) cin >> a[i];
  b[0] = 1;
  for (int i = 1; i <= p.size(); i++) b[i] = b[i - 1] * base % mod;
  for (int i = 1; i <= p.size(); i++) h[i] = (h[i - 1] * base + p[i - 1]) % mod;
  for (int i = 1; i <= p.size(); i++)
    if (subh(0, i) == subh(p.size() - i, p.size())) g[i] = 1;
  for (int i = 1; i < m; i++)
    if (a[i - 1] + p.size() > a[i])
      if (!g[a[i - 1] + p.size() - a[i]]) return cout << 0, 0;
  ans += a[0] - 1;
  for (int i = 1; i < m; i++) ans += max(0ll, a[i] - a[i - 1] - (int)p.size());
  ans += n - a[m - 1] - p.size() + 1;
  long long res = 1;
  for (int i = 0; i < ans; i++) res = (res * 26) % mod;
  cout << res;
  return 0;
}
