#include <bits/stdc++.h>
const int N = 200005;
using namespace std;
char a[N], b[N];
int lena, lenb;
int da[N];
bool vis[N];
bool check(int mid) {
  memset(vis, 0, sizeof vis);
  for (int i = 1; i <= mid; i++) vis[da[i]] = 1;
  int j = 1, sum = 0;
  for (int i = 1; i <= lena; i++) {
    if (vis[i]) continue;
    if (a[i] == b[j]) {
      j++;
    }
  }
  if (j - 1 == lenb) return 1;
  return 0;
}
int main() {
  scanf("%s%s", a + 1, b + 1);
  lena = strlen(a + 1);
  lenb = strlen(b + 1);
  for (int i = 1; i <= lena; i++) scanf("%d", &da[i]);
  int l = 0, r = lena, mid, ans;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (check(mid))
      l = mid + 1;
    else
      r = mid - 1;
  }
  printf("%d\n", r);
  return 0;
}
