#include <bits/stdc++.h>
using namespace std;
void init() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
}
int main() {
  init();
  string t, p;
  cin >> t >> p;
  long long n = t.length();
  long long a[n];
  for (long long it = 0; it < n; it++) cin >> a[it];
  ;
  long long l = 0, h = n, ans = 0;
  while (l <= h) {
    long long m = (l + h) / 2, j = 0;
    vector<bool> cut(n);
    for (long long i = 0; i < m; i++) cut[a[i] - 1] = 1;
    for (long long i = 0; i < n && j < p.length(); i++)
      if (t[i] == p[j] && !cut[i]) j++;
    if (j == p.length())
      ans = m, l = m + 1;
    else
      h = m - 1;
  }
  cout << ans;
}
