#include <bits/stdc++.h>
using namespace std;
int n;
int a[2000000];
string s, t;
int cheak(int mid) {
  string v = s;
  for (int i = 0; i < mid + 1; i++) v[a[i] - 1] = '-';
  string h = "";
  for (int i = 0; i < n; i++)
    if (v[i] != '-') h += v[i];
  string as = "";
  int idx = 0;
  for (int i = 0; i < h.length(); i++) {
    if (h[i] == t[idx]) {
      if (idx == t.length() - 1) return true;
      idx++;
    }
  }
  return false;
}
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  cin >> s >> t;
  n = s.length();
  for (int i = 0; i < n; i++) cin >> a[i];
  int l = 0, r = n - 1;
  int mid;
  while (l <= r) {
    mid = (l + r) / 2;
    if (cheak(mid)) {
      l = mid + 1;
    } else {
      r = mid - 1;
    }
  }
  cout << l << "\n";
}
