#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 10;
int a[MAXN], lt, lp, sign = 0, ans = 0;
char t[MAXN], p[MAXN];
bool del[MAXN];
inline bool check(char *a, char *b) {
  int p1 = 1, p2 = 1;
  while (p1 <= lp && p2 <= lt) {
    if (del[p2]) {
      ++p2;
      continue;
    }
    if (a[p1] == b[p2]) {
      ++p1, ++p2;
    } else
      ++p2;
  }
  return p1 > lp;
}
int main() {
  scanf("%s%s", t + 1, p + 1);
  lt = strlen(t + 1), lp = strlen(p + 1);
  for (int i = 1; i <= lt; ++i) scanf("%d", &a[i]);
  memset(del, 0, sizeof(del));
  int l = 1, r = lt, mid;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (sign < mid)
      for (int i = sign + 1; i <= mid; ++i) del[a[i]] = 1;
    else
      for (int i = mid + 1; i <= sign; ++i) del[a[i]] = 0;
    sign = mid;
    if (check(p, t))
      l = mid + 1, ans = mid;
    else
      r = mid - 1;
  }
  printf("%d\n", ans);
  return 0;
}
