#include <bits/stdc++.h>
using namespace std;
string t, p;
vector<int> a;
bool check(int m) {
  string current;
  vector<bool> used(t.length(), true);
  for (int i = 0; i < m; i++) {
    used[a[i] - 1] = false;
  }
  for (int i = 0; i < t.length(); i++) {
    if (!used[i]) {
      current += t[i];
    }
  }
  int it = 0;
  for (int i = 0; i < current.length(); i++) {
    if (it == p.length()) {
      break;
    } else if (current[i] == p[it]) {
      it++;
    }
  }
  if (it == p.length()) {
    return true;
  } else {
    return false;
  }
}
int main() {
  cin >> t >> p;
  a.resize(t.length());
  for (int i = 0; i < t.length(); i++) {
    cin >> a[i];
  }
  reverse(a.begin(), a.end());
  int l = -1, r = t.length();
  while (r - l > 1) {
    int m = (l + r) / 2;
    if (check(m)) {
      r = m;
    } else {
      l = m;
    }
  }
  cout << t.length() - r << endl;
  return 0;
}
