#include <bits/stdc++.h>
using namespace std;
int z[(int)2e6 + 100];
const int mod = (int)1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  string p;
  cin >> p;
  int k = p.size();
  int l = 0, r = 0;
  for (int i = 1; i <= k - 1; i++) {
    if (r >= i) z[i] = min(z[i - l], r - i + 1);
    while (z[i] + i < k && p[z[i]] == p[z[i] + i]) z[i]++;
    if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;
  }
  int t;
  cin >> t;
  int cnt = 0;
  for (int i = 2; i <= m; i++) {
    int x;
    cin >> x;
    if (t + k - 1 >= x) cnt += t + k - x;
    if (z[x - t] != k - (x - t) && t + k - 1 >= x) cout << 0, exit(0);
    t = x;
  }
  long long ans = 1;
  cnt = n - k * m + cnt;
  for (int i = 1; i <= cnt; i++) {
    ans *= 26;
    ans %= mod;
  }
  cout << ans;
  return 0;
}
