#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 10;
char S[MAXN], T[MAXN];
int N, M;
int A[MAXN];
bool has[MAXN];
bool moo(int g) {
  memset(has, 0, sizeof(has));
  for (int i = 0; i < g; i++) {
    has[A[i]] = true;
  }
  int cur = 0;
  for (int i = 0; i < N; i++) {
    if (has[i]) {
      continue;
    }
    cur += (S[i] == T[cur]);
    if (cur == M) {
      return true;
    }
  }
  return false;
}
int main() {
  scanf("%s %s", S, T);
  N = strlen(S);
  M = strlen(T);
  for (int i = 0; i < N; i++) {
    scanf("%d", &A[i]);
    A[i]--;
  }
  int lo = 0, hi = N;
  while (hi - lo > 1) {
    int mid = (lo + hi) / 2;
    if (moo(mid)) {
      lo = mid;
    } else {
      hi = mid;
    }
  }
  printf("%d\n", lo);
}
