#include <bits/stdc++.h>
using namespace std;
int seach(int n);
string s1, s2;
int num[200005];
int main(void) {
  cin >> s1 >> s2;
  for (int i = 0; i < s1.size(); i++) cin >> num[i];
  int l = 0, r = s1.size() - 1;
  while (r - l != 1) {
    if (seach((l + r) / 2)) {
      l = (l + r) / 2;
    } else {
      r = (l + r) / 2;
    }
  }
  if (l > 0)
    cout << l + 1;
  else if (seach(0))
    cout << "1";
  else
    cout << "0";
  return 0;
}
int seach(int n) {
  string s;
  bool flag = 0;
  int po = 0;
  s = s1;
  for (int i = 0; i <= n; i++) s[num[i] - 1] = '*';
  for (int i = 0; i < s1.size() && po < s2.size(); i++) {
    if (s[i] == s2[po]) po++;
  }
  if (po == s2.size()) flag = 1;
  return flag;
}
