#include <bits/stdc++.h>
using namespace std;
string s, t;
int a[200005];
int n;
bool ck(int k) {
  vector<int> p;
  for (int i = k; i < n; i++) {
    p.push_back(a[i]);
  }
  sort(p.begin(), p.end());
  string ss;
  for (int f : p) {
    ss += s[f];
  }
  int m = t.size();
  int i = 0, j = 0;
  while (j < ss.size()) {
    if (t[i] == ss[j]) {
      i++, j++;
    } else
      j++;
    if (i == m) break;
  }
  return i == m;
}
int main() {
  cin >> s >> t;
  n = s.size();
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i]--;
  }
  int hi = n, lo = 0, mid, ans = 0;
  while (hi >= lo) {
    mid = (hi + lo) / 2;
    if (ck(mid)) {
      ans = mid;
      lo = mid + 1;
    } else
      hi = mid - 1;
  }
  cout << ans << endl;
  return 0;
}
