#include <bits/stdc++.h>
using namespace std;
string s, t;
vector<int> a;
vector<bool> u;
int n, m;
bool check(int x) {
  int p = 0, i;
  u.resize(n);
  for (i = 0; i < x; i++) u[a[i] - 1] = true;
  for (i = 0; i < n && p < m; i++)
    if (!u[i] && t[i] == s[p]) p++;
  u.clear();
  return p == m;
}
int bin() {
  int l = 0, r = n;
  while (l < r) {
    int mid = (l + r + 1) / 2;
    if (check(mid))
      l = mid;
    else
      r = mid - 1;
  }
  return l;
}
int main() {
  int i;
  cin >> t >> s;
  n = t.length();
  m = s.length();
  a.resize(n);
  for (i = 0; i < n; i++) cin >> a[i];
  cout << bin();
  return 0;
}
