#include <bits/stdc++.h>
using namespace std;
string s1, s2;
int ar[200001];
int n;
int n2;
bool possible(int check) {
  int posi[200001] = {0};
  for (int i = 0; i < check + 1; i++) {
    posi[ar[i]]++;
  }
  int start1 = 0;
  int start2 = 0;
  while (start1 < n && start2 < n2) {
    if (posi[start1]) {
      start1++;
      continue;
    }
    if (s1[start1] == s2[start2]) {
      start1++;
      start2++;
    } else
      start1++;
  }
  if (start2 == n2) {
    return true;
  }
  return false;
}
int main() {
  cin >> s1 >> s2;
  n = s1.length();
  n2 = s2.length();
  for (int i = 0; i < n; i++) {
    scanf("%d", &ar[i]);
    ar[i]--;
  }
  int start = 0;
  int end = n;
  int ans = -1;
  while (start < end) {
    int mid = (start + end) / 2;
    if (possible(mid)) {
      ans = mid;
      start = mid + 1;
    } else {
      end = mid;
    }
  }
  cout << ans + 1 << endl;
  return 0;
}
