#include <bits/stdc++.h>
using namespace std;
struct PolyHash {
  static const int mod = 1e9 + 123;
  static vector<int> pow1;
  static vector<unsigned long long> pow2;
  static int base;
  vector<int> pref1;
  vector<unsigned long long> pref2;
  PolyHash(string& s) : pref1(s.size() + 1, 0), pref2(s.size() + 1, 0) {
    while (pow1.size() <= s.size())
      pow1.push_back(1LL * pow1.back() * base % mod),
          pow2.push_back(pow2.back() * base);
    for (int i = 0; i < s.size(); i++)
      pref1[i + 1] = (pref1[i] + 1LL * s[i] * pow1[i]) % mod,
                pref2[i + 1] = (pref2[i] + s[i] * pow2[i]);
  }
  inline pair<int, unsigned long long> operator()(int pos, int len,
                                                  int mxpow = 0) const {
    int hash1 = pref1[pos + len] - pref1[pos];
    unsigned long long hash2 = pref2[pos + len] - pref2[pos];
    hash1 += (hash1 < 0 ? mod : 0);
    if (mxpow)
      hash1 = 1LL * hash1 * pow1[mxpow - (pos + len - 1)] % mod,
      hash2 = hash2 * pow2[mxpow - (pos + len - 1)];
    return {hash1, hash2};
  }
};
int PolyHash::base(1e9 + 7);
vector<int> PolyHash::pow1{1};
vector<unsigned long long> PolyHash::pow2{1};
int n, m;
string p;
int y[1000006];
bool cont() {
  bool ret = 1;
  PolyHash hash_p(p);
  for (int i = 1; i < m; i++)
    if (y[i] - y[i - 1] < p.size()) {
      auto h1 = hash_p(y[i] - y[i - 1], p.size() - (y[i] - y[i - 1]), p.size());
      auto h2 = hash_p(0, p.size() - (y[i] - y[i - 1]), p.size());
      ret &= (h1 == h2);
    }
  return ret;
}
int main() {
  cin >> n >> m;
  cin >> p;
  for (int i = 0; i < m; i++) cin >> y[i];
  int po = (m ? y[0] + n - y[m - 1] - p.size() : n);
  for (int i = 1; i < m; i++) po += max(0, y[i] - y[i - 1] - (int)p.size());
  if (cont() || !m) {
    int ans = 1;
    while (po--) ans = (ans * 26LL) % (int)(1e9 + 7);
    cout << ans << endl;
  } else
    cout << 0 << endl;
}
