#include <bits/stdc++.h>
using namespace std;
bool used[200000];
int main() {
  string a, b;
  cin >> a >> b;
  string t;
  vector<int> V;
  int n = a.length();
  for (int i = 0; i < a.length(); ++i) {
    int ind;
    cin >> ind;
    V.push_back(ind - 1);
  }
  int l = 0;
  int r = n - 1;
  int mid;
  int i = 0;
  while (l < r && i < 20) {
    i++;
    mid = (l + r) / 2;
    for (int i = 0; i < mid; ++i) {
      used[V[i]] = true;
    }
    int j = 0;
    for (int i = 0; i < a.length(); ++i) {
      if (used[i] == true) continue;
      if (a[i] == b[j]) j++;
      if (j == b.length()) break;
    }
    if (j == b.length())
      l = mid;
    else
      r = mid;
    for (int i = 0; i < n; ++i) used[i] = false;
  }
  for (int i = 0; i < mid + 1; ++i) {
    used[V[i]] = true;
  }
  int j = 0;
  for (int i = 0; i < a.length(); ++i) {
    if (used[i] == true) continue;
    if (a[i] == b[j]) j++;
    if (j == b.length()) break;
  }
  if (j == b.length())
    cout << mid + 1;
  else
    cout << mid;
  return 0;
}
