#include <bits/stdc++.h>
using namespace std;
char a[200005], b[200005];
int x, y, p, s, vs[200005], c[200005];
bool chk(int m) {
  memset(vs, 0, sizeof(vs));
  for (int i = 1; i <= m; i++) vs[c[i]] = 1;
  for (int i = 1, j = 1; j <= y; j++) {
    while (i <= x && (a[i] != b[j] || vs[i])) i++;
    if (i > x) return 0;
    i++;
  }
  return 1;
}
int main() {
  scanf("%s%s", a + 1, b + 1);
  x = strlen(a + 1), y = strlen(b + 1);
  for (int i = 1; i <= x; i++) scanf("%d", &c[i]);
  int s = 0, l = 0, r = x;
  while (l < r) {
    int m = (l + r + 1) >> 1;
    if (chk(m))
      l = m;
    else
      r = m - 1;
  }
  printf("%d\n", r);
}
