#include <bits/stdc++.h>
using namespace std;
bool Check(vector<long long> &A, string S, string T, long long m) {
  long long i, j, n = S.size();
  for (i = 0; i <= m; ++i) {
    S[A[i]] = '0';
  }
  j = 0;
  for (i = 0; i < n; ++i) {
    if (S[i] == T[j]) {
      ++j;
    }
    if (j == T.size()) {
      return 1;
    }
  }
  return 0;
}
int main() {
  long long i, j, n;
  string S, T;
  cin >> S >> T;
  n = S.size();
  vector<long long> A(n);
  for (i = 0; i < n; ++i) {
    cin >> A[i];
    --A[i];
  }
  long long left = 0, mid, right = n - 1;
  while (left + 1 < right) {
    mid = left + (right - left) / 2;
    if (Check(A, S, T, mid)) {
      left = mid;
    } else {
      right = mid - 1;
    }
  }
  if (Check(A, S, T, right)) {
    cout << right + 1 << "\n";
  } else if (Check(A, S, T, left))
    cout << left + 1 << "\n";
  else
    cout << "0\n";
  return 0;
}
