#include <bits/stdc++.h>
using namespace std;
string p, t;
int a[200000];
bool check(int k);
int binary();
int main() {
  int i, ans;
  cin >> t >> p;
  for (i = 0; i < t.size(); i++) cin >> a[i];
  t[t.size()] = '\0';
  p[p.size()] = '\0';
  ans = binary();
  cout << ans << endl;
  return 0;
}
int binary() {
  int left, right, mid, ans = 0;
  left = 0;
  right = t.size();
  while (left <= right) {
    mid = left + (right - left) / 2;
    if (check(mid)) {
      ans = mid;
      left = mid + 1;
    } else
      right = mid - 1;
  }
  return ans;
}
bool check(int k) {
  string temp = t;
  int i, j = 0;
  for (i = 0; i < k; i++) {
    temp[a[i] - 1] = '$';
  }
  for (i = 0; i < t.size(); i++) {
    if (p[j] == temp[i] && j < p.size()) {
      j++;
    }
  }
  if (p[j] == '\0') return true;
  return false;
}
