#include <bits/stdc++.h>
using namespace std;
int main() {
  char a[200010], b[200010];
  int i, c[200010], d[200010];
  scanf("%s%s", a, b);
  int la = (int)strlen(a), lb = (int)strlen(b), ans = 0;
  for (i = 1; i <= la; i++) {
    scanf("%d", &c[i]);
  }
  int left = 0, right = la;
  while (left <= right) {
    int mid = (left + right) / 2;
    memset(d, 0, sizeof(d));
    for (int i = 1; i <= mid; i++) d[c[i] - 1] = 1;
    int nl = 0;
    for (int i = 0; i < la && nl < lb; i++)
      if (!d[i] && a[i] == b[nl]) nl++;
    if (nl == lb) {
      ans = mid;
      left = mid + 1;
    } else
      right = mid - 1;
  }
  printf("%d\n", ans);
  return 0;
}
