#include <bits/stdc++.h>
using namespace std;
int arr[200200];
bool isUsed[200200];
int main(int argc, char** argv) {
  string p, t;
  cin >> t >> p;
  int len = t.size();
  for (int i = 0; i < len; i++) {
    scanf("%d", &arr[i]);
    arr[i]--;
  }
  int l = 0;
  int r = len;
  while (l < r) {
    int mid = (l + r) / 2;
    memset(isUsed, false, sizeof(isUsed));
    for (int i = 0; i <= mid; i++) {
      isUsed[arr[i]] = true;
    }
    bool isFound = false;
    int index = 0;
    for (int i = 0; i < len; i++) {
      if (isUsed[i]) continue;
      if (p[index] == t[i]) index++;
      if (index == p.length()) {
        isFound = true;
        break;
      }
    }
    if (isFound)
      l = mid + 1;
    else
      r = mid;
  }
  cout << r;
  return 0;
}
