#include <bits/stdc++.h>
using namespace std;
string t, p;
vector<int> perm(200001);
bool substringof(string big, string small) {
  int holtart = 0;
  for (char c : big) {
    if (holtart == small.size()) return true;
    if (small[holtart] == c) holtart++;
    if (holtart == small.size()) return true;
  }
  return holtart == small.size();
}
bool jo(int hany) {
  vector<bool> kivett(t.size(), false);
  for (int i = 0; i < hany; i++) kivett[perm[i]] = true;
  string big = "";
  for (int i = 0; i < t.size(); i++) {
    if (!kivett[i]) big.push_back(t[i]);
  }
  return substringof(big, p);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> t >> p;
  for (int i = 0; i < t.size(); i++) {
    cin >> perm[i];
    perm[i]--;
  }
  int kezd = 0, veg = t.size();
  if (jo(veg)) {
    cout << veg;
    return 0;
  }
  while (kezd < veg) {
    int kozep = (kezd + veg) / 2;
    if (!jo(kozep))
      veg = kozep - 1;
    else if (!jo(kozep + 1))
      kezd = veg = kozep;
    else
      kezd = kozep + 1;
  }
  cout << kezd;
}
