#include <bits/stdc++.h>
using namespace std;
const int N = 200000 + 10, inf = 0x3f3f3f3f;
int a[N], n, m;
char s[N], p[N], tmp[N];
int vis[N];
int check(int x) {
  memset(vis, 0, sizeof(vis));
  for (int i = 1; i <= x; i++) vis[a[i]] = 1;
  int cur = 1, cnt = 1;
  while (cur <= n && cnt <= m) {
    if (!vis[cur] && s[cur] == p[cnt]) cnt++;
    cur++;
  }
  if (cnt == m + 1) return 1;
  return 0;
}
int main() {
  scanf("%s%s", s + 1, p + 1);
  n = strlen(s + 1);
  m = strlen(p + 1);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  int l = 1, r = n, mid;
  int yes = -1;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (check(mid))
      l = mid + 1, yes = 1;
    else
      r = mid - 1;
  }
  printf("%d\n", r);
  return 0;
}
