#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
char t[N], p[N], s[N];
bool f[N];
int n, m;
int per[N];
bool check(int x) {
  if (n - x < m) return false;
  memset(f, true, sizeof(f));
  for (int i = 0; i < x; i++) f[per[i]] = false;
  int k = 0;
  for (int i = 0; i < n; i++) {
    if (f[i]) s[k++] = t[i];
  }
  s[k] = '\0';
  int i = 0, j = 0;
  for (; j < m; i++) {
    if (i >= k) return false;
    if (s[i] == p[j]) j++;
  }
  return true;
}
int main() {
  gets(t);
  gets(p);
  n = strlen(t);
  m = strlen(p);
  for (int i = 0; i < n; i++) {
    scanf("%d", &per[i]);
    per[i]--;
  }
  int l = 0, r = n, mid;
  while (l < r) {
    mid = (l + r + 1) / 2;
    if (check(mid))
      l = mid;
    else
      r = mid - 1;
  }
  printf("%d\n", l);
  return 0;
}
