#include <bits/stdc++.h>
using namespace std;
string t, p;
int pos[200001];
bool possible(int k) {
  int i, j = 0;
  bool crossed[200001];
  for (i = 0; i < t.length(); i++) crossed[i] = false;
  for (i = 0; i < k; i++) crossed[pos[i] - 1] = true;
  i = 0;
  while (i < t.length() && j < p.length()) {
    if (crossed[i]) {
      i++;
      continue;
    }
    if (t[i] == p[j]) {
      i++;
      j++;
    } else
      i++;
  }
  if (j == p.length())
    return true;
  else
    return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int i, start, end, mid;
  cin >> t >> p;
  for (i = 0; i < t.length(); i++) cin >> pos[i];
  start = 0;
  end = t.length() - p.length();
  while (start <= end) {
    mid = (start + end) / 2;
    if (possible(mid) && !possible(mid + 1))
      break;
    else {
      if (possible(mid))
        start = mid + 1;
      else
        end = mid - 1;
    }
  }
  cout << mid;
}
