#include <bits/stdc++.h>
using namespace std;
__attribute__((constructor)) void fast_iostream() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
}
int main() {
  string t, p;
  cin >> t >> p;
  int n = t.length();
  vector<int> a(n);
  for (int &x : a) {
    cin >> x;
    --x;
  }
  int l = 0;
  int r = n;
  while (r - l > 1) {
    int m = l + (r - l) / 2;
    vector<int> b(a.begin(), a.begin() + m);
    sort(b.begin(), b.end());
    int it = 0;
    int ib = 0;
    int ip = 0;
    for (; ip != p.length() and it != t.length(); ++it) {
      if (b[ib] == it) {
        ++ib;
        continue;
      }
      if (t[it] == p[ip]) {
        ++ip;
      }
    }
    if (ip == p.length()) {
      l = m;
    } else {
      r = m;
    }
  }
  cout << l << endl;
}
