#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
char t[maxn], p[maxn];
int pos[maxn], len_t, len_p, mark[maxn];
bool cheak(int x) {
  if (len_t - x < len_p) return false;
  for (int i = 0; i < len_t; ++i) mark[i] = 0;
  for (int i = 1; i <= x; ++i) mark[pos[i]] = 1;
  int i = 0, j = 0;
  while (j < len_t) {
    while (mark[j]) j++;
    if (p[i] == t[j]) {
      i++;
      j++;
    } else if (p[i] != t[j])
      j++;
    if (i == len_p) return true;
  }
  return false;
}
int main() {
  while (scanf("%s", t) != EOF) {
    scanf("%s", p);
    len_t = strlen(t);
    len_p = strlen(p);
    for (int i = 1; i <= len_t; ++i) {
      scanf("%d", &pos[i]);
      pos[i]--;
    }
    int left = 0, right = len_t - len_p + 1;
    while (right - left > 1) {
      int mid = (left + right) / 2;
      if (cheak(mid))
        left = mid;
      else
        right = mid;
    }
    printf("%d\n", left);
  }
  return 0;
}
