#include <bits/stdc++.h>
using namespace std;
bool contains(string t, string p) {
  int pos = 0;
  for (int i = 0; i < (t).size() && pos < (p).size(); ++i)
    if (t[i] == p[pos]) ++pos;
  return pos == (p).size();
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string t, p;
  cin >> t >> p;
  int *perm = new int[(t).size()];
  for (int i = 0; i < (t).size(); ++i) {
    cin >> perm[i];
    --perm[i];
  }
  int l = 0, r = (t).size();
  while (l != r) {
    int m = (l + r) >> 1;
    string cur;
    bool *b = new bool[(t).size()];
    fill(b, b + (t).size(), true);
    for (int i = 0; i < m; ++i) b[perm[i]] = false;
    for (int i = 0; i < (t).size(); ++i)
      if (b[i]) cur.push_back(t[i]);
    if (contains(cur, p))
      l = m + 1;
    else
      r = m;
  }
  cout << l - 1 << endl;
  return 0;
}
