#include <bits/stdc++.h>
using namespace std;
const int N = (int)2e5 + 10;
int n, m, ans;
char a[N], b[N];
int p[N];
bool del[N];
bool chk(int x) {
  memset(del, 0, sizeof(del));
  for (int i = 1; i <= x; i++) del[p[i]] = 1;
  int j = 1;
  for (int i = 1; i <= n; i++)
    if (!del[i]) {
      if (a[i] == b[j]) {
        j++;
        if (j > m) break;
      }
    }
  return j > m;
}
int main() {
  scanf("%s", a + 1);
  scanf("%s", b + 1);
  n = strlen(a + 1);
  m = strlen(b + 1);
  for (int i = 1; i <= n; i++) scanf("%d", p + i);
  int l = 0, r = n;
  while (l <= r) {
    int mid = (l + r) / 2;
    if (chk(mid))
      ans = mid, l = mid + 1;
    else
      r = mid - 1;
  }
  printf("%d\n", ans);
  return 0;
}
