#include <bits/stdc++.h>
const int maxLen = 200000;
char A[maxLen + 1], B[maxLen + 1], C[maxLen + 1];
int v[maxLen + 1];
bool bad[maxLen + 1];
int main() {
  gets(A);
  gets(B);
  int N = strlen(A);
  for (int i = 1; i <= N; ++i) {
    scanf("%d", &v[i]);
    --v[i];
  }
  int st = 1, dr = N, ans = 0;
  while (st <= dr) {
    int mid = (st + dr) >> 1;
    memset(bad, 0, sizeof bad);
    for (int i = 1; i <= mid; ++i) bad[v[i]] = true;
    int n = 0;
    for (int i = 0; i < N; ++i) {
      if (!bad[i]) C[n++] = A[i];
    }
    int a, b;
    a = b = 0;
    while (a < n and b < strlen(B)) {
      if (C[a] == B[b]) ++b;
      ++a;
    }
    if (b == strlen(B)) {
      ans = mid;
      st = mid + 1;
    } else
      dr = mid - 1;
  }
  printf("%d\n", ans);
  return 0;
}
