#include <bits/stdc++.h>
using namespace std;
bool ok(string a, string b) {
  if (a.size() < b.size()) return 0;
  int i = 0, j = 0;
  while (i < a.size() && j < b.size()) {
    if (a[i] == b[j])
      i++, j++;
    else
      i++;
  }
  return j == b.size();
}
int main() {
  string t, p;
  cin >> t >> p;
  int n = t.size();
  int v[n];
  for (int i = 0; i < n; i++) cin >> v[i];
  int l = 0, r = n, ans = 0;
  while (l <= r) {
    int mid = (l + r) / 2;
    unordered_set<int> remov;
    for (int j = 0; j < mid; j++) remov.insert(v[j] - 1);
    string s = "";
    for (int i = 0; i < t.size(); i++)
      if (!remov.count(i)) s += t[i];
    if (ok(s, p)) {
      ans = mid;
      l = mid + 1;
    } else
      r = mid - 1;
  }
  cout << ans << endl;
  return 0;
}
