#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-8;
const double Pi = acos(-1);
bool inline equ(double a, double b) { return fabs(a - b) < EPS; }
int _R(int& x) { return scanf("%d", &x); }
int _R(long long& x) { return scanf("%" PRId64, &x); }
int _R(double& x) { return scanf("%lf", &x); }
int _R(char* s) { return scanf("%s", s); }
int R() { return 0; }
template <typename T1, typename... T2>
int R(T1& x, T2&... tail) {
  int tmp = _R(x);
  return tmp + R(tail...);
}
template <typename Iter, typename F>
inline void out(Iter s, Iter e, F of) {
  bool flag = 0;
  for (Iter it = s; it != e; it++) {
    if (flag)
      printf(" ");
    else
      flag = 1;
    of(*it);
  }
  puts("");
}
const int MAXN = 2e5 + 10;
char txt[MAXN], pat[MAXN];
int m;
int n, a[MAXN], A[MAXN];
inline bool ok(int x) {
  static char s[MAXN];
  int len = 0;
  for (int i = (1); i <= (n); i++) {
    if (A[i] > x) s[++len] = txt[i];
  }
  int j = 1;
  for (int i = (1); i <= (len); i++) {
    if (s[i] == pat[j]) j++;
    if (j > m) return 1;
  }
  return 0;
}
int main() {
  scanf("%s%s", txt + 1, pat + 1);
  m = strlen(pat + 1);
  n = strlen(txt + 1);
  for (int i = (1); i <= (n); i++) R(a[i]);
  for (int i = (1); i <= (n); i++) A[a[i]] = i;
  int l = 1, r = n, ans = 0;
  while (l <= r) {
    int mid = (l + r) / 2;
    if (ok(mid))
      l = mid + 1, ans = mid;
    else
      r = mid - 1;
  }
  printf("%d\n", ans);
}
