#include <bits/stdc++.h>
using namespace std;
struct __STARTER_OF_PROGRAM__ {
  __STARTER_OF_PROGRAM__() { cerr << "Code by H~$~C: \n" << flush; }
} __starter_of_program__;
struct __ENDDER_OF_PROGRAM__ {
  ~__ENDDER_OF_PROGRAM__() {}
} __endder_of_program__;
template <typename T>
using min_queue = priority_queue<T, vector<T>, greater<T> >;
template <typename T>
using max_queue = priority_queue<T>;
template <typename... T>
using void_t = void;
template <typename T>
inline T chmax(T &x, T y) {
  return x = max(x, y);
}
template <typename T>
inline T chmin(T &x, T y) {
  return x = min(x, y);
}
template <typename T>
inline T chmax(T &x, initializer_list<T> i) {
  return x = max(x, max(i));
}
template <typename T>
inline T chmin(T &x, initializer_list<T> i) {
  return x = min(x, min(i));
}
template <typename T>
inline void reinit(T &t) {
  t.~T();
  new (&t) T();
}
mt19937 gen(chrono::steady_clock::now().time_since_epoch().count());
const double EPS = 1e-9, PI = acos(-1.0);
const int inf = 0x3f3f3f3f;
const long long lnf = 0x3f3f3f3f3f3f3f3f;
const int mod = 1000000007;
inline int modpower(int x, int y) {
  int res = 1;
  while (y) {
    if (y & 1) res = 1LL * res * x % mod;
    x = 1LL * x * x % mod, y >>= 1;
  }
  return res;
}
void buildZ(const string &str, int *z) {
  int l = 0, r = 0;
  int n = ((int)str.size());
  for (int i = (1); i <= (n - 1); ++i) {
    if (i <= r) z[i] = min(z[i - l], r - i + 1);
    while (i + z[i] < n && str[i + z[i]] == str[z[i]]) ++z[i];
    if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;
  }
}
int n, m, cnt;
string str;
int pos[1000005];
int z[1000005];
int a[1000005];
int main(int argc, const char *argv[]) {
  scanf("%d%d", &n, &m);
  if (!m) return printf("%d\n", modpower(26, n)) & 0;
  {
    static char _str[1000005 + 1];
    scanf("%s", _str);
    str = _str;
  };
  buildZ(str, z);
  for (int i = 0; i < (m); ++i) scanf("%d", a + i), a[i]--;
  cnt = a[0];
  for (int i = (1); i <= (m - 1); ++i) {
    if (a[i] - a[i - 1] >= ((int)str.size())) {
      cnt += a[i] - a[i - 1] - ((int)str.size());
      continue;
    }
    int pos = a[i] - a[i - 1];
    if (pos + z[pos] < ((int)str.size()))
      return putchar('0') & putchar('\n') & 0;
  }
  cnt += n - (a[m - 1] + ((int)str.size()));
  printf("%d\n", modpower(26, cnt));
  return 0;
}
