#include <bits/stdc++.h>
using std::pair;
using std::string;
using std::vector;
const int oo = 0x3f3f3f3f;
template <typename T>
inline bool chkmax(T &a, T b) {
  return a < b ? a = b, true : false;
}
template <typename T>
inline bool chkmin(T &a, T b) {
  return b < a ? a = b, true : false;
}
string procStatus() {
  std::ifstream t("/proc/self/status");
  return string(std::istreambuf_iterator<char>(t),
                std::istreambuf_iterator<char>());
}
template <typename T>
T read(T &first) {
  int f = 1;
  char ch = getchar_unlocked();
  for (; !isdigit(ch); ch = getchar_unlocked())
    if (ch == '-') f = -1;
  for (first = 0; isdigit(ch); ch = getchar_unlocked())
    first = 10 * first + ch - '0';
  return first *= f;
}
template <typename T>
void write(T first) {
  if (first == 0) {
    putchar_unlocked('0');
    return;
  }
  if (first < 0) {
    putchar_unlocked('-');
    first = -first;
  }
  static char s[20];
  int top = 0;
  for (; first; first /= 10) s[++top] = first % 10 + '0';
  while (top) putchar_unlocked(s[top--]);
}
const int MAXN = 2e5 + 5;
int N, M;
char T[MAXN], P[MAXN];
int A[MAXN];
void input() {
  scanf("%s", T + 1);
  N = strlen(T + 1);
  scanf("%s", P + 1);
  M = strlen(P + 1);
  for (int i = 1; i <= N; ++i) {
    read(A[i]);
  }
}
bool check(int first) {
  static bool flag[MAXN];
  std::fill(flag + 1, flag + N + 1, false);
  for (int i = 1; i <= first; ++i) {
    flag[A[i]] = true;
  }
  int max = 0;
  for (int i = 1; i <= N && max < M; ++i) {
    if (flag[i]) continue;
    if (T[i] == P[max + 1]) ++max;
  }
  return max == M;
}
void solve() {
  int l = 0, r = N;
  while (l + 1 < r) {
    int mid = (l + r) >> 1;
    if (check(mid))
      l = mid;
    else
      r = mid;
  }
  printf("%d\n", l);
}
int main() {
  input();
  solve();
  return 0;
}
