#include <bits/stdc++.h>
using namespace std;
vector<int> arr;
string g, p;
bool check(int id) {
  string w = g;
  for (int i = 0; i < id; i++) w[arr[i]] = '1';
  int q = 0;
  for (int i = 0; i < w.size(); i++) {
    if (q == p.size()) return 1;
    if (w[i] == p[q]) q++;
  }
  if (q == p.size()) return 1;
  return 0;
}
int main() {
  cin >> g >> p;
  for (int i = 0; i < g.size(); i++) {
    int t;
    cin >> t;
    arr.push_back(t - 1);
  }
  int Min = 0, Max = g.size() - 1;
  while (Min + 5 <= Max) {
    int Med = (Min + Max) / 2;
    if (check(Med))
      Min = Med;
    else
      Max = Med;
  }
  while (Min <= Max) {
    if (check(Max)) {
      cout << Max << endl;
      return 0;
    }
    Max--;
  }
}
