#include <bits/stdc++.h>
using namespace std;
string s, t;
int a[200007];
bool check(int k) {
  string p = s;
  for (int i = 0; i <= k; i++) p[a[i]] = '*';
  int j = 0;
  for (int i = 0; i < p.length(); i++) {
    if (p[i] == t[j]) j++;
    if (j >= t.length()) return 1;
  }
  return 0;
}
int main() {
  int k;
  cin >> s >> t;
  for (int i = 0; i < s.length(); i++) {
    cin >> k;
    a[i] = k - 1;
  }
  int l = 0, r = s.length() - 1;
  while (r > l) {
    int mid = (l + r + 1) >> 1;
    if (check(mid))
      l = mid;
    else
      r = mid - 1;
  }
  if (check(0))
    cout << l + 1 << endl;
  else
    cout << 0 << endl;
}
