#include <bits/stdc++.h>
using namespace std;
int a[200010], n, m;
char s1[200010], s2[200010];
bool cant[200010];
bool check(int x) {
  memset(cant, 0, sizeof(cant));
  for (int i = 1; i <= x; ++i) cant[a[i]] = 1;
  int j = 1;
  for (int i = 1; i <= n; ++i)
    if ((!cant[i]) && s1[i] == s2[j]) {
      ++j;
      if (j > m) return 1;
    }
  return 0;
}
int main() {
  scanf("%s%s", s1 + 1, s2 + 1);
  n = strlen(s1 + 1);
  m = strlen(s2 + 1);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  int l = 0, r = n - 1;
  while (l < r) {
    int mid = ((l + r + 1) >> 1);
    if (check(mid))
      l = mid;
    else
      r = mid - 1;
  }
  printf("%d\n", l);
  return 0;
}
