#include <bits/stdc++.h>
const int maxn = 200001;
struct String_Game {
  char A[maxn], B[maxn], c[maxn];
  int pos[maxn], N, n;
  void init() {
    scanf("%s%s", &A, &B);
    N = strlen(A);
    n = strlen(B);
    for (int i = 1; i <= N; i++) scanf("%d", pos + i);
  }
  bool check(int p) {
    strcpy(c, A);
    for (int i = 1; i <= p; i++) c[pos[i] - 1] = 0;
    int j = 0;
    for (int i = 0; i < N && j < n; i++) {
      if (c[i] == 0) continue;
      if (c[i] == B[j]) j++;
    }
    if (j == n)
      return 1;
    else
      return 0;
  }
  void work() {
    int L = 0, R = N, ans, M;
    while (L <= R) {
      M = (L + R) >> 1;
      if (check(M)) {
        L = M + 1;
        ans = M;
      } else
        R = M - 1;
    }
    printf("%d\n", ans);
  }
} sol;
int main() {
  sol.init();
  sol.work();
  return 0;
}
