#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
int a[N];
char s[N], t[N], tmp[N];
int mark[N];
int len_t, len_s;
bool check(int mid) {
  string tmp;
  memset(mark, 0, sizeof mark);
  for (int i = 1; i <= mid; i++) mark[a[i]] = 1;
  for (int i = 1; i <= len_s; i++)
    if (!mark[i]) tmp += s[i];
  int inx = 1;
  for (int i = 0; i < tmp.size(); i++) {
    if (tmp[i] == t[inx]) inx++;
    if (inx == len_t + 1) break;
  }
  return inx == len_t + 1;
}
int main() {
  scanf("%s", s + 1);
  scanf("%s", t + 1);
  len_s = strlen(s + 1);
  len_t = strlen(t + 1);
  for (int i = 1; i <= len_s; i++) {
    scanf("%d", &a[i]);
  }
  int l = 0, r = len_s;
  int ans = 0;
  while (l <= r) {
    int mid = (l + r) / 2;
    if (check(mid))
      l = mid + 1, ans = max(ans, mid);
    else
      r = mid - 1;
  }
  printf("%d\n", ans);
  return 0;
}
