#include <bits/stdc++.h>
using namespace std;
const int maxn = 200001;
vector<char> now;
char t[maxn], p[maxn];
int lt, lp, l, r;
int a[maxn];
bool judge(int cur) {
  now.clear();
  bool tmp[maxn];
  for (int i = 1; i <= lt; i++) tmp[i] = true;
  for (int i = 1; i <= cur; i++) tmp[a[i]] = false;
  for (int i = 1; i <= lt; i++)
    if (tmp[i]) now.push_back(t[i]);
  int pos = 0;
  for (int i = 0; i < now.size(); i++) {
    if (now[i] == p[pos + 1]) pos++;
    if (pos == lp) break;
  }
  if (pos == lp)
    return true;
  else
    return false;
}
int main() {
  int temp;
  lt = 0;
  temp = getchar();
  while (temp != '\n') {
    lt++;
    t[lt] = temp;
    temp = getchar();
  }
  lp = 0;
  temp = getchar();
  while (temp != '\n') {
    lp++;
    p[lp] = temp;
    temp = getchar();
  }
  for (int i = 1; i <= lt; i++) scanf("%d", &a[i]);
  l = 0;
  r = lt;
  while (l + 1 < r) {
    int mid = (l + r) >> 1;
    if (judge(mid))
      l = mid;
    else
      r = mid;
  }
  printf("%d\n", l);
  return 0;
}
