#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
long long bigmod(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret = (ret * a) % 1000000007;
    b >>= 1;
    a = (a * a) % 1000000007;
  }
  return ret;
}
long long inverse(long long n) { return bigmod(n, 1000000007 - 2); }
bool checkBit(int n, int i) { return (n & (1 << i)); }
int setBit(int n, int i) { return (n | (1 << i)); }
int resetBit(int n, int i) { return (n & (~(1 << i))); }
bool odd(long long n) { return (n & 1); }
char p[1000010];
int z[1000010], y[1000010];
void z_function() {
  int n = strlen(p);
  z[0] = 0;
  int l = 0, r = 0;
  for (int i = 1; p[i]; ++i) {
    if (i <= r) z[i] = min(z[i - l], r - i + 1);
    while (i + z[i] < n && p[i + z[i]] == p[z[i]]) ++z[i];
    if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;
  }
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  scanf("%s", p);
  int l = strlen(p);
  z_function();
  for (int i = 0; i < m; ++i) scanf("%d", &y[i]);
  long long ans = 1;
  if (m == 0) {
    for (int i = 0; i < n; ++i) ans *= 26, ans %= 1000000007;
    cout << ans << endl;
    return 0;
  }
  if (y[0] != 1) {
    for (int i = 0; i < y[0] - 1; ++i) ans *= 26, ans %= 1000000007;
  }
  for (int i = 1; i < m; ++i) {
    if (y[i] - y[i - 1] >= l) {
      for (int j = 0; j < y[i] - y[i - 1] - l; ++j)
        ans *= 26, ans %= 1000000007;
    } else {
      if (z[y[i] - y[i - 1]] >= y[i - 1] + l - y[i]) continue;
      cout << 0 << endl;
      return 0;
    }
  }
  for (int i = y[m - 1] + l - 1; i < n; ++i) ans *= 26, ans %= 1000000007;
  cout << ans << endl;
  return 0;
}
