#include <bits/stdc++.h>
using namespace std;
std::string tmp;
std::string p;
int np;
int n, m;
int y[1000000 + 1000];
int prefix[1000000 + 1000];
int z[1000000 + 1000];
void makePrefix() {
  int j = 0;
  prefix[0] = 0;
  for (int i = 1; i < np; i++) {
    while (j > 0 && p[j] != p[i]) {
      j = prefix[j - 1];
    }
    if (p[j] == p[i]) {
      j++;
    }
    prefix[i] = j;
  }
}
void makeZ() {
  int L = 0, R = 0;
  for (int i = 1; i < np; i++) {
    if (i > R) {
      L = R = i;
      while (R < np && p[R - L] == p[R]) R++;
      z[i] = R - L;
      R--;
    } else {
      int k = i - L;
      if (z[k] < R - i + 1) {
        z[i] = z[k];
      } else {
        L = i;
      }
      while (R < np && p[R - L] == p[R]) {
        R++;
      }
      z[i] = R - L;
      R--;
    }
  }
}
int match(int left, int right) {
  if (left == right) {
    return true;
  } else if (right - left >= np) {
    return true;
  } else {
    int d = right - left;
    return z[d] == np - d;
  }
}
int getNoncovered(int left, int right) {
  if (right - left < np) {
    return 0;
  } else {
    return right - left - np;
  }
}
int main() {
  getline(cin, tmp);
  stringstream ss(tmp);
  ss >> n >> m;
  getline(cin, p);
  np = p.size();
  getline(cin, tmp);
  stringstream ss2(tmp);
  for (int i = 0; i < m; i++) {
    ss2 >> y[i];
    y[i]--;
  }
  makeZ();
  int noncovered = 0;
  if (m == 0) {
    noncovered = n;
  } else {
    noncovered += y[0];
    for (int i = 1; i < m; i++) {
      if (!match(y[i - 1], y[i])) {
        cout << 0 << endl;
        return 0;
      }
      noncovered += getNoncovered(y[i - 1], y[i]);
    }
    noncovered += n - y[m - 1] - np;
  }
  unsigned long long int ans = 1;
  for (int i = 0; i < noncovered; i++) {
    ans *= 26;
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
