#include <bits/stdc++.h>
using namespace std;
int read() {
  int v = 0, f = 1;
  char c = getchar();
  while (c < 48 || 57 < c) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (48 <= c && c <= 57) v = (v << 3) + v + v + c - 48, c = getchar();
  return v * f;
}
const int N = 300000;
bool vis[N];
char p[N], s[N], t[N];
int n, m, a[N];
bool check(int mid) {
  for (int i = 1; i <= n; i++) vis[i] = 0;
  for (int i = 1; i <= mid; i++) vis[a[i]] = 1;
  int cnt = 0;
  for (int i = 1; i <= n; i++)
    if (!vis[i]) p[++cnt] = s[i];
  int now = 0;
  for (int i = 1; i <= cnt; i++)
    if (t[now + 1] == p[i]) now++;
  if (now == m)
    return 1;
  else
    return 0;
}
int main() {
  scanf("%s", s + 1);
  scanf("%s", t + 1);
  n = strlen(s + 1);
  m = strlen(t + 1);
  t[m + 1] = '$';
  for (int i = 1; i <= n; i++) a[i] = read();
  int l = 0, r = n;
  while (l < r) {
    int mid = l + r + 1 >> 1;
    if (check(mid))
      l = mid;
    else
      r = mid - 1;
  }
  printf("%d\n", l);
}
