#include <bits/stdc++.h>
using namespace std;
int a[200005], n;
bool mark[200005];
string t, p;
bool check(int x) {
  memset(mark, 0, sizeof(mark));
  for (int i = 0; i < x; i++) mark[a[i]] = true;
  string s = "";
  for (int i = 0; i < n; i++)
    if (!mark[i]) s += t[i];
  int i, j;
  for (i = 0, j = 0; i < s.size() && j < p.size(); i++) {
    if (s[i] == p[j]) j++;
  }
  if (j == p.size()) return true;
  return false;
}
int main() {
  cin >> t >> p;
  n = (int)t.size();
  for (int i = 0; i < n; i++) {
    int tmp;
    scanf("%d", &tmp);
    a[i] = tmp - 1;
  }
  int ans = 0, l = 0, r = n;
  while (l <= r) {
    int mid = (l + r) / 2;
    if (check(mid)) {
      l = mid + 1;
      ans = mid;
    } else
      r = mid - 1;
  }
  cout << ans << endl;
}
