#include <bits/stdc++.h>
using namespace std;
const int MX = int(2e5) + 10;
int n, m, A[MX], tok[MX];
char S[MX], P[MX];
void solve() {
  scanf("%s\n%s", S, P);
  n = strlen(S), m = strlen(P);
  for (int i = 0; i < n; i++) scanf("%d", &A[i]), --A[i];
  int l = -1, r = n, md;
  while (l < r) {
    md = r - (r - l) / 2;
    memset(tok, 0, sizeof tok);
    for (int i = 0; i <= md; i++) tok[A[i]] = 1;
    int fnd = 0, i, j;
    for (i = 0, j = 0; i < m; i++) {
      fnd = 0;
      while (j < n && !fnd) {
        fnd |= (!tok[j] && S[j] == P[i]);
        j++;
      }
      if (!fnd) break;
    }
    if (fnd && i == m)
      l = md;
    else
      r = md - 1;
  }
  printf("%d\n", l + 1);
}
int main() { solve(); }
