#include <bits/stdc++.h>
using namespace std;
string st, sf;
string solve, bun;
int i, j, n, m, v[200005];
bool poz[200005];
int eposibil(int f) {
  int i;
  string sir;
  for (i = 0; i <= n; i++) poz[i] = 0;
  for (i = 1; i <= f; i++) poz[v[i] - 1] = 1;
  for (i = 0; i < n; i++)
    if (poz[i] == 0) sir += st[i];
  i = 0;
  int j = 0;
  int n = sir.size();
  int m = sf.size();
  while (i < n && j < m) {
    if (sir[i] == sf[j]) {
      i++;
      j++;
    } else
      i++;
  }
  return j == m;
}
int cautbin(int l, int r) {
  while (l != r) {
    int m = (l + r + 1) / 2;
    if (eposibil(m))
      l = m;
    else
      r = m - 1;
  }
  return l;
}
int main() {
  cin >> st >> sf;
  n = st.size();
  m = sf.size();
  for (i = 1; i <= n; i++) cin >> v[i];
  cout << cautbin(0, n);
  return 0;
}
