#include <bits/stdc++.h>
using namespace std;
string p, t, s;
int P[200001] = {0};
int mans = 0, mid;
inline bool check(int x) {
  int c = 0;
  s = p;
  for (int i = 1; i <= x; i++) s[P[i] - 1] = '?';
  for (int i = 0; i <= s.length() - 1; i++)
    if (s[i] == t[c] && c < t.length()) c++;
  if (c == t.length()) return true;
  return false;
}
int main() {
  cin >> p;
  cin >> t;
  for (int i = 1; i <= p.length(); i++) scanf("%d", &P[i]);
  int l = 0;
  int r = p.length();
  while (l <= r) {
    mid = l + (r - l) / 2;
    if (check(mid))
      l = mid + 1, mans = max(mans, mid);
    else
      r = mid - 1;
  }
  printf("%d", mans);
}
