#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
char a[N], b[N];
int la, lb, c[N], n;
bool vis[N];
bool judge(int x) {
  for (int i = 1; i <= x; ++i) vis[c[i]] = true;
  int t = 1;
  for (int i = 1; i <= la; ++i) {
    if (vis[i]) continue;
    if (a[i] == b[t]) {
      t++;
      if (t == lb + 1) break;
    }
  }
  for (int i = 1; i <= x; ++i) vis[c[i]] = false;
  return t == lb + 1;
}
int main() {
  scanf("%s%s", a + 1, b + 1);
  la = strlen(a + 1);
  lb = strlen(b + 1);
  for (int i = 1; i <= la; ++i) scanf("%d", &c[i]);
  int l = 0, r = la, ret = -1;
  while (l <= r) {
    int m = (l + r) >> 1;
    if (judge(m))
      ret = m, l = m + 1;
    else
      r = m - 1;
  }
  printf("%d\n", ret);
  return 0;
}
