#include <bits/stdc++.h>
using namespace std;
bool solve(string temp, string p) {
  int i = 0, j = 0;
  while (i != temp.size()) {
    if (temp[i] == p[j]) {
      i++;
      j++;
    } else
      i++;
    if (j == p.size()) break;
  }
  if (i <= temp.size() && j >= p.size())
    return true;
  else
    return false;
}
int main() {
  string s, p;
  cin >> s >> p;
  int n = s.size();
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  int lo = 0, hi = n - 1, mid = (hi + lo) / 2;
  while (lo <= hi) {
    string temp = s;
    for (int i = 0; i < mid; i++) temp[arr[i] - 1] = '0';
    if (solve(temp, p))
      lo = mid + 1;
    else
      hi = mid - 1;
    mid = (hi + lo) / 2;
  }
  cout << mid;
}
