#include <bits/stdc++.h>
using namespace std;
int ans = -1;
char a[200010], b[200010];
int del[200010];
int vis[200010];
int lena, lenb;
int check(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 && a[i] == b[now]) now++;
    if (now == lenb) break;
  }
  return now == lenb ? 1 : 0;
}
int main() {
  scanf("%s%s", a, b);
  lena = strlen(a);
  lenb = strlen(b);
  for (int i = 0; i < lena; i++) scanf("%d", &del[i]);
  int l = 0, r = lena - 1;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (check(mid)) {
      l = mid + 1;
      ans = mid;
    } else
      r = mid - 1;
  }
  printf("%d\n", ans + 1);
  return 0;
}
