#include <bits/stdc++.h>
using namespace std;
int n;
string l;
string p;
vector<int> a;
bool get(int m) {
  vector<char> temp;
  vector<char> temp2;
  for (int i = 0; i < l.length(); i++) temp.push_back(l[i]);
  for (int i = 0; i < m; i++) {
    temp[a[i]] = 'A';
  }
  for (int i = 0; i < l.length(); i++)
    if (temp[i] != 'A') temp2.push_back(temp[i]);
  int index = 0;
  for (int i = 0; i < temp2.size(); i++) {
    if (temp2[i] == p[index]) index++;
    if (index == p.length()) break;
  }
  return (index == p.length());
}
int find_one(int l, int r) {
  if (l >= r) return -1;
  while (l < r) {
    int m = (r + l) / 2;
    if (get(m)) {
      if (m == l) {
        if (get(r)) return r;
        return l;
      }
      l = m;
    } else {
      r = m - 1;
    }
  }
  return l;
}
int main() {
  cin >> l;
  cin >> p;
  int t = l.length();
  int x;
  while (t--) {
    cin >> x;
    a.push_back(x - 1);
  }
  cout << find_one(0, l.length() - 1);
  return 0;
}
