#include <bits/stdc++.h>
using namespace std;
const double sn = 1e-6;
char t[200005], p[200005];
bool del[200005];
int sz, sz2;
int perm[200005];
bool check(int v) {
  for (int i = 0; i < v; i++) {
    del[perm[i]] = true;
  }
  int c = 0;
  for (int i = 0; i < sz; i++) {
    if (!del[i]) {
      if (p[c] == t[i]) {
        c++;
        if (c == sz2) return true;
      }
    }
  }
  return false;
}
int main() {
  scanf("%s%s", t, p);
  sz = strlen(t);
  sz2 = strlen(p);
  for (int i = 0; i < sz; i++) {
    int t;
    scanf("%d", &t);
    perm[i] = t - 1;
  }
  int l = 0, r = sz;
  while (l != r) {
    int mid = (l + r + 1) / 2;
    if (check(mid))
      l = mid;
    else
      r = mid - 1;
    for (int i = 0; i < sz; i++) del[i] = false;
  }
  printf("%d\n", l);
  return 0;
}
