#include <bits/stdc++.h>
using namespace std;
char t[200003], p[200003];
int a, pos[200003], nt, np;
bool check(int mid) {
  int it = 0;
  for (int ip = 0; ip < np; ip++) {
    while (it < nt && (t[it] != p[ip] || pos[it + 1] <= mid)) it++;
    if (it == nt) return false;
    it++;
  }
  return true;
}
int main() {
  scanf("%s", t);
  scanf("%s", p);
  nt = strlen(t);
  np = strlen(p);
  for (int i = 1; i <= nt; i++) {
    scanf("%d", &a);
    pos[a] = i;
  }
  int lo = 1, mid, hi = nt;
  while (hi >= lo) {
    mid = (lo + hi) / 2;
    if (check(mid))
      lo = mid + 1;
    else
      hi = mid - 1;
  }
  printf("%d\n", hi);
}
