#include <bits/stdc++.h>
bool match(const char* text, const char* pattern, int n, int m) {
  int post = 0, posp = 0;
  while (post < n && posp < m) {
    if (text[post] == pattern[posp]) {
      ++post;
      ++posp;
    } else
      ++post;
  }
  return (posp == m);
}
char data[200002], filt[200002], srch[200002], pat[200002];
int perm[200002];
int main() {
  scanf("%s", data + 1);
  scanf("%s", pat);
  int n = strlen(data + 1);
  int m = strlen(pat);
  for (int _k = (1), _n = (n), i = _k; i <= _n; ++i) {
    scanf("%d", &perm[i]);
  }
  int lo = 0;
  int hi = n;
  while (lo <= hi) {
    int mid = (lo + hi) / 2;
    memcpy(filt + 1, data + 1, n + 1);
    for (int _k = (1), _n = (mid), i = _k; i <= _n; ++i) filt[perm[i]] = -1;
    int pos = 0;
    memset(srch, 0, n);
    for (int _k = (1), _n = (n), i = _k; i <= _n; ++i)
      if (filt[i] != -1) srch[pos++] = filt[i];
    if (!match(srch, pat, pos, m))
      hi = mid - 1;
    else
      lo = mid + 1;
  }
  int answer = hi;
  printf("%d\n", answer);
  return 0;
}
