#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
struct custom_hash {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};
vector<string> vec_splitter(string s) {
  s += ',';
  vector<string> res;
  while (!s.empty()) {
    res.push_back(s.substr(0, s.find(',')));
    s = s.substr(s.find(',') + 1);
  }
  return res;
}
void debug_out(vector<string> __attribute__((unused)) args,
               __attribute__((unused)) int idx,
               __attribute__((unused)) int LINE_NUM) {
  cerr << endl;
}
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
  if (idx > 0)
    cerr << ", ";
  else
    cerr << "Line(" << LINE_NUM << ") ";
  stringstream ss;
  ss << H;
  cerr << args[idx] << " = " << ss.str();
  debug_out(args, idx + 1, LINE_NUM, T...);
}
const long long MOD = (int)1e9 + 7;
const long long INF = 2e18 + 5;
struct hashLL {
  size_t operator()(long long x) const {
    x = (x ^ (x >> 30)) * UINT64_C(0xbf58476d1ce4e5b9);
    x = (x ^ (x >> 27)) * UINT64_C(0x94d049bb133111eb);
    x = x ^ (x >> 31);
    return x;
  }
};
long long inv(long long a, long long b) {
  return 1 < a ? b - inv(b % a, a) * b / a : 1;
}
template <class T>
void coutend(T arg) {
  cout << arg << '\n';
}
template <class T>
void coutsp(T arg) {
  cout << arg << ' ';
}
template <class T>
void coutarrsp(T arr, int l, int r) {
  for (int i = l; i <= r; i++) {
    cout << arr[i] << ' ';
  }
  cout << '\n';
}
template <class T>
void coutarr(T arr, int l, int r) {
  for (int i = l; i <= r; i++) {
    cout << arr[i];
  }
  cout << '\n';
}
long long gcd(long long a, long long b, long long &x, long long &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  long long x1, y1;
  long long d = gcd(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return d;
}
long long distsq(long long x1, long long y1, long long x2, long long y2) {
  return (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
}
const int N = 2000001;
long long n, m, k, t, u, v, p;
string s;
int arr[N];
char possible[N];
int prefix[N];
void generate() {
  prefix[0] = 0;
  for (int i = 1; i < N; i++) {
    int j = prefix[i - 1];
    while (j > 0 && possible[i] != possible[j]) {
      j = prefix[j - 1];
    }
    if (possible[i] == possible[j]) {
      j++;
    }
    prefix[i] = j;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  cin >> s;
  int sn = s.size();
  for (int i = 0; i < (N); i++) possible[i] = '?';
  for (int i = 0; i < (sn); i++) {
    possible[i] = s[i];
  }
  possible[sn] = '#';
  int offset = sn;
  vector<int> ends;
  for (int i = 0; i < (m); i++) {
    cin >> arr[i];
  }
  for (int i = m - 1; i >= 0; i--) {
    for (int j = 0; j < sn; j++) {
      int pos = offset + arr[i] + j;
      if (possible[pos] != '?') break;
      possible[pos] = s[j];
    }
    ends.push_back(offset + arr[i] + sn - 1);
  }
  generate();
  bool gd = true;
  for (int pos : ends) {
    if (prefix[pos] != sn) {
      gd = false;
      break;
    }
  }
  long long ans = 1;
  if (!gd) {
    coutend(0);
    return 0;
  }
  for (int i = 0; i < n; i++) {
    if (possible[sn + 1 + i] == '?') {
      ans = (ans * 26) % MOD;
    }
  }
  coutend(ans);
}
