#include <bits/stdc++.h>
const int SZ = 2e5 + 5;
using namespace std;
int n, p[SZ];
string s, t;
bool valid(int idx) {
  string tmp = s;
  for (int i = 0; i < idx; i++) {
    tmp[p[i]] = '.';
  }
  string tmp2 = "";
  for (int i = 0; i < n; i++) {
    if (tmp[i] != '.') tmp2 += tmp[i];
  }
  int i, j;
  int m = tmp2.size();
  int k = t.size();
  for (i = 0, j = 0; i < m && j < k; i++) {
    if (t[j] == tmp2[i]) j++;
  }
  return (j == k);
}
int binarySearch() {
  int f = 0, e = n;
  while (f <= e) {
    int m = f + e >> 1;
    if (valid(m))
      f = m + 1;
    else
      e = m - 1;
  }
  return f - 1;
}
int main() {
  cin >> s >> t;
  n = s.size();
  for (int i = 0; i < n; i++) {
    cin >> p[i];
    p[i]--;
  }
  cout << binarySearch();
}
