#include <bits/stdc++.h>
char a[200005], b[200005], c[200005];
int v[200005], n, m;
bool verif(int poz) {
  int i, j;
  for (i = 1; i <= n; i++) c[i] = a[i];
  for (i = 1; i <= poz; i++) c[v[i]] = 0;
  for (i = 1, j = 1; i <= n && j <= m; i++)
    if (c[i] == b[j]) j++;
  if (j == m + 1) return true;
  return false;
}
int main() {
  int i, st, dr, mij, rasp = 0;
  char ch;
  ch = fgetc(stdin);
  while (ch >= 'a' && ch <= 'z') {
    n++;
    a[n] = ch;
    ch = fgetc(stdin);
  }
  ch = fgetc(stdin);
  while (ch >= 'a' && ch <= 'z') {
    m++;
    b[m] = ch;
    ch = fgetc(stdin);
  }
  for (i = 1; i <= n; i++) fscanf(stdin, "%d", &v[i]);
  st = 1;
  dr = n;
  while (st <= dr) {
    mij = (st + dr) / 2;
    if (verif(mij) == true) {
      rasp = mij;
      st = mij + 1;
    } else {
      dr = mij - 1;
    }
  }
  fprintf(stdout, "%d", rasp);
  fclose(stdin);
  fclose(stdout);
  return 0;
}
