#include <bits/stdc++.h>
using namespace std;
int k, mx, ans, b;
string s, t;
int f[100009 * 2], a[2 * 100009], v[100009 * 2];
map<char, int> m;
int main() {
  cin >> s >> t;
  int p = s.size();
  for (int i = 1; i <= p; i++) cin >> a[i];
  int l = 0;
  int r = p;
  while (l <= r) {
    memset(v, 0, sizeof(v));
    int md = (l + r) / 2;
    k = 0;
    for (int j = 1; j <= md; j++) v[a[j]] = 1;
    for (int i = 0; i < p; i++)
      if (v[i + 1] == 0 and s[i] == t[k]) k++;
    if (k >= t.size())
      l = md + 1;
    else
      r = md - 1;
  }
  cout << r;
}
