#include <bits/stdc++.h>
using namespace std;
const string el = "\n";
const string elel = "\n\n";
const string sp = " ";
const string spsp = "  ";
const string tab = "\t";
string a, b;
int s[200009];
int sub[200009];
int judge(int t) {
  memset(sub, 0, sizeof(sub));
  for (int i = 1; i <= t; i++) sub[s[i]] = 1;
  int ai = 0, bi = 0;
  for (; ai < a.length(); ai++) {
    if (sub[ai + 1]) continue;
    if (a[ai] == b[bi]) bi++;
    if (bi == b.length()) return 1;
  }
  return 0;
}
int main() {
  cin >> a >> b;
  for (int i = 1; i <= a.length(); i++) {
    scanf("%d", &s[i]);
  }
  int l = 0, r = a.length(), mid;
  while (r - l > 1) {
    mid = r + l >> 1;
    if (judge(mid))
      l = mid;
    else
      r = mid;
  }
  printf("%d\n", l);
}
