#include <bits/stdc++.h>
using namespace std;
bool b[200001];
int a[200001];
string t, p;
bool check(int indx) {
  for (int i = 0; i < t.length(); i++) b[i] = false;
  for (int i = 0; i < indx; i++) {
    b[a[i] - 1] = true;
  }
  int counter = 0;
  for (int i = 0; i < t.length(); i++) {
    if (counter == p.length()) break;
    if (!b[i] && t[i] == p[counter]) {
      counter++;
    }
  }
  return counter == p.length();
}
int main() {
  cin >> t >> p;
  int length = t.length();
  for (int i = 0; i < length; i++) {
    cin >> a[i];
  }
  int l = 0, r = length - 1, m;
  while (l <= r) {
    m = (l + r) / 2;
    if (check(m)) {
      l = m + 1;
    } else {
      r = m - 1;
    }
  }
  cout << r << endl;
  cin >> a[0];
  return 0;
}
