#include <bits/stdc++.h>
using namespace std;
const int maxn = 400000 + 10;
char T[maxn], S[maxn], P[maxn];
int a[maxn];
int lent, lens, lenp;
bool vis[maxn];
inline bool check(int mid) {
  for (int i = 1; i <= mid; i++) vis[a[i]] = 1;
  lenp = 0;
  for (int i = 1; i <= lent; i++)
    if (!vis[i]) P[lenp++] = T[i];
  P[lenp] = '\0';
  int pos = 0;
  for (int i = 0; i < lenp; i++)
    if (S[pos] == P[i] && pos < lens) pos++;
  for (int i = 1; i <= mid; i++) vis[a[i]] = 0;
  return pos == lens;
}
int main() {
  if (fopen("D.in", "r") != NULL) {
    freopen("D.in", "r", stdin);
    freopen("D.out", "w", stdout);
  }
  scanf("%s%s", T + 1, S);
  lent = strlen(T + 1);
  lens = strlen(S);
  for (int i = 1; i <= lent; i++) scanf("%d", &a[i]);
  int L = 0, R = lent + 1;
  while (L + 1 < R) {
    int mid = (L + R) >> 1;
    if (check(mid))
      L = mid;
    else
      R = mid;
  }
  printf("%d\n", L);
  return 0;
}
