#include <bits/stdc++.h>
const int maxn = 200000 + 10;
char s1[maxn], s2[maxn];
int a[maxn];
bool c[maxn];
int ls1, ls2;
int m, l, r;
bool check(int t) {
  memset(c, 0, sizeof(c));
  for (int i = 0; i < t; i++) c[a[i] - 1] = true;
  int j = 0;
  for (int i = 0; i < ls1; i++) {
    if (c[i] == false) {
      if (s1[i] == s2[j]) j++;
      if (j == ls2) break;
    }
  }
  return (j >= ls2);
}
int main(void) {
  scanf("%s%s", s1, s2);
  ls1 = strlen(s1);
  ls2 = strlen(s2);
  for (int i = 0; i < ls1; i++) scanf("%d", &a[i]);
  l = 0, r = ls1 - ls2;
  while (l < r) {
    m = l + (r - l + 1) / 2;
    if (check(m))
      l = m;
    else
      r = m - 1;
  }
  printf("%d\n", l);
  return 0;
}
