#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 100;
char s[MAXN], t[MAXN];
int a[MAXN];
bool sRemoved[MAXN];
int sLen, tLen;
bool noProblem(int removeN) {
  memset(sRemoved, 0, sizeof(sRemoved));
  for (int i = 1; i < removeN + 1; i++) sRemoved[a[i]] = true;
  int j = 0;
  for (int i = 0; i < sLen; i++) {
    if (!sRemoved[i])
      if (s[i] == t[j]) {
        j++;
        if (j >= tLen) return true;
      }
  }
  return false;
}
int main() {
  int l, r, mid, res;
  scanf("%s", s);
  sLen = strlen(s);
  scanf("%s", t);
  tLen = strlen(t);
  for (int i = 1; i < sLen + 1; i++) {
    scanf("%d", &a[i]);
    a[i]--;
  }
  l = 0;
  r = sLen;
  res = 0;
  while (l <= r) {
    mid = (l + r) / 2;
    if (noProblem(mid)) {
      l = mid + 1;
      res = max(res, mid);
    } else {
      r = mid - 1;
    }
  }
  printf("%d\n", res);
  return 0;
}
