#include <bits/stdc++.h>
using namespace std;
char a[200500];
char b[200500];
int del[200500];
int vis[200500];
int lena, lenb;
int Slove(int mid) {
  memset(vis, 0, sizeof(vis));
  for (int i = 0; i <= mid; i++) {
    vis[del[i] - 1] = 1;
  }
  int now = 0;
  for (int i = 0; i < lena; i++) {
    if (vis[i] == 0) {
      if (a[i] == b[now]) {
        now++;
      }
    }
  }
  if (now == lenb)
    return 1;
  else
    return 0;
}
int main() {
  while (~scanf("%s%s", a, b)) {
    lena = strlen(a);
    lenb = strlen(b);
    for (int i = 0; i < lena; i++) scanf("%d", &del[i]);
    int ans = -1;
    int l = 0;
    int r = lena - 1;
    while (r - l >= 0) {
      int mid = (l + r) / 2;
      if (Slove(mid) == 1) {
        l = mid + 1;
        ans = mid;
      } else
        r = mid - 1;
    }
    printf("%d\n", ans + 1);
  }
}
