#include <bits/stdc++.h>
using namespace std;
char t[200105], p[200105];
bool there[200105];
int ara[200105];
int lent, lenp;
bool f(int x) {
  memset(there, true, sizeof(there));
  for (int i = 0; i < x; i++) {
    there[ara[i] - 1] = false;
  }
  int pp = 0;
  for (int i = 0; i < lent && pp < lenp; i++) {
    if (there[i] && p[pp] == t[i]) pp++;
  }
  return (pp == lenp);
}
int bin_search() {
  int low = 0, high = lent, mid;
  while (high > low) {
    mid = (high + low) >> 1;
    bool fg = f(mid);
    if (!fg)
      high = mid;
    else
      low = mid + 1;
  }
  return high - 1;
}
int main() {
  scanf("%s", t);
  scanf("%s", p);
  lent = strlen(t);
  lenp = strlen(p);
  for (int i = 0; i < lent; i++) {
    scanf("%d", &ara[i]);
  }
  printf("%d\n", bin_search());
  return 0;
}
