#include <bits/stdc++.h>
using namespace std;
int i, n, p[200005], st, dr, pivot, rs;
bool viz[200005];
string a, b;
bool check(int x) {
  memset(viz, 0, sizeof(viz));
  string now;
  for (int i = 1; i <= x; ++i) viz[p[i]] = 1;
  for (int i = 0; i < n; ++i)
    if (!viz[i + 1]) now += a[i];
  int i = 0;
  for (auto it : now)
    if (it == b[i]) ++i;
  return i == b.size();
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> a >> b;
  n = a.size();
  for (i = 1; i <= n; ++i) cin >> p[i];
  st = 0;
  dr = n;
  while (st <= dr) {
    pivot = (st + dr) / 2;
    if (check(pivot))
      rs = pivot, st = pivot + 1;
    else
      dr = pivot - 1;
  }
  cout << rs << '\n';
  return 0;
}
