#include <bits/stdc++.h>
using namespace std;
ifstream in("input.txt");
ofstream out("output.txt");
string s, p;
int n, a[212345];
bool b[212345];
bool check(int m) {
  int i, j;
  for (i = 0; i < n; i++) b[i] = true;
  for (i = 0; i < m; i++) b[a[i] - 1] = false;
  j = 0;
  for (i = 0; i < p.length(); i++) {
    while (j < n) {
      if (s[j] == p[i] && b[j]) break;
      j++;
    }
    if (j < n)
      j++;
    else
      return false;
  }
  return true;
}
int main() {
  ios_base ::sync_with_stdio(false);
  int i;
  cin >> s >> p;
  n = s.length();
  for (i = 0; i < n; i++) cin >> a[i];
  int l = 0, r = n;
  while (l < r) {
    int m = (l + r) / 2 + 1;
    if (check(m))
      l = m;
    else
      r = m - 1;
  }
  cout << l;
  return 0;
}
