#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
long long n, m, k;
string t, p;
int a[MAXN], b[MAXN];
bool chk() {
  int j = 0;
  for (int i = 0; i < n; i++) {
    if (b[i]) continue;
    if (p[j] == t[i]) j++;
    if (j == m) return 1;
  }
  return 0;
}
int bs() {
  int s = 0, e = n - 1, mid;
  while (s <= e) {
    mid = (s + e) / 2;
    for (int i = 0; i <= mid; i++) b[a[i]] = 1;
    if (chk())
      s = mid + 1;
    else
      e = mid - 1;
    for (int i = 0; i <= mid; i++) b[a[i]] = 0;
  }
  return (e + 1);
}
int main() {
  ios::sync_with_stdio(NULL);
  cin.tie(0);
  cin >> t >> p;
  n = t.size();
  m = p.size();
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i]--;
  }
  cout << bs() << "\n";
}
