#include <bits/stdc++.h>
using namespace std;
string inic, obj;
vector<int> v;
bool dachegar(int ind) {
  vector<bool> tira(inic.size(), true);
  string tillnow = "";
  for (int i = 0; i < (ind); ++i) {
    tira[v[i] - 1] = false;
  }
  for (int i = 0; i < (inic.size()); ++i) {
    if (tira[i]) tillnow += inic[i];
  }
  int iter = 0, j = 0;
  char cur;
  while (iter < obj.size() and j < tillnow.size()) {
    cur = obj[iter];
    if (cur == tillnow[j]) iter++;
    j++;
  }
  return iter == obj.size();
}
int main() {
  int aux;
  cin >> inic >> obj;
  for (int i = 0; i < (inic.size()); ++i) {
    scanf("%d", &aux);
    v.push_back(aux);
  }
  int lo = 0, hi = inic.size(), mid;
  while (hi > lo) {
    mid = lo + (hi - lo) / 2;
    if (!dachegar(mid))
      hi = mid;
    else
      lo = mid + 1;
  }
  cout << lo - 1 << endl;
}
