#include <bits/stdc++.h>
using namespace std;
int C[200005], visited[200005];
string A, B;
int fun(int k, int n, int n1) {
  int i, j = 0;
  for (i = 0; i <= k; i++) visited[C[i]] = 1;
  for (i = 0; i < n; i++) {
    if (!visited[i] && j < n1 && B[j] == A[i]) {
      j++;
    }
  }
  if (j == n1)
    return 1;
  else {
    for (i = 0; i <= k; i++) visited[C[i]] = 0;
    return 0;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  memset(visited, 0, sizeof(visited));
  cin >> A >> B;
  int n, i, p, b, start = 0;
  n = A.length();
  for (i = 0; i < n; i++) {
    cin >> C[i];
    C[i]--;
  }
  b = B.length();
  p = n - 1;
  if (fun(0, n, b) == 0)
    cout << 0 << endl;
  else {
    while (start + 1 < p) {
      int mid = (start + p) / 2;
      if (fun(mid, n, b))
        start = mid;
      else
        p = mid;
    }
    cout << start + 1 << endl;
  }
  return 0;
}
