#include <bits/stdc++.h>
using namespace std;
char s[200023], c[200023];
int N, len, used[200023], ind[200023];
int bin(int l, int r) {
  while (r - l > 1) {
    int m = (r + l) / 2;
    for (int i = 0; i < m; i++) {
      used[ind[i]] = 1;
    }
    int k = 0, boo = 0;
    for (int i = 0; i < N; i++) {
      if (!used[i] && s[i] == c[k]) {
        k++;
      }
      if (k == len) {
        boo = 1;
        break;
      }
    }
    for (int i = 0; i < N; i++) {
      used[i] = 0;
    }
    if (boo) {
      l = m;
    } else {
      r = m;
    }
  }
  return l;
}
int main() {
  gets(s);
  gets(c);
  N = strlen(s);
  len = strlen(c);
  for (int i = 0; i < N; i++) {
    scanf("%d", &ind[i]);
    ind[i]--;
  }
  printf("%d\n", bin(0, N));
  return 0;
}
