#include <bits/stdc++.h>
using namespace std;
int lena, lenb;
string a, b;
int del[200001], noused[200001];
int IsLegal(int k) {
  int i = 0, j = 0;
  while (i < lena && j < lenb) {
    if (a[i] != b[j])
      i++;
    else {
      if (noused[i] != 0 && noused[i] <= k)
        i++;
      else {
        i++;
        j++;
        if (j == lenb) return 1;
      }
    }
  }
  return 0;
}
int main() {
  cin >> a >> b;
  lena = a.size();
  lenb = b.size();
  int x;
  for (int i = 1; i <= lena; i++) {
    cin >> x;
    del[i] = x - 1;
    noused[del[i]] = i;
  }
  int left = 0, right = lena;
  while (left < right) {
    int j = (left + right) / 2;
    if (IsLegal(j))
      left = j;
    else
      right = j - 1;
    if ((right - left) == 1) {
      if (IsLegal(right))
        cout << right;
      else
        cout << left;
      return 0;
    }
  }
  cout << left << endl;
  return 0;
}
