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