#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n = 1, len1, len2, ans;
int operation[N];
bool book[N];
char s1[N], s2[N];
vector<int> num;
bool check(int x) {
  num.clear();
  for (register int i = x + 1; i <= n; i++)
    if (book[s1[operation[i]]]) num.push_back(operation[i]);
  sort(num.begin(), num.end());
  register int i = 0, j = 1;
  while (i < (int)num.size() && j <= len2) {
    if (s1[num[i]] == s2[j])
      i++, j++;
    else
      i++;
  }
  if (j == len2 + 1)
    return true;
  else
    return false;
}
inline void fuc(int l, int r) {
  if (l > r) return;
  int mid = (l + r) >> 1;
  if (check(mid))
    ans = mid, fuc(mid + 1, r);
  else
    fuc(l, mid - 1);
}
int main() {
  scanf("%s", s1 + 1);
  scanf("%s", s2 + 1);
  len1 = strlen(s1 + 1);
  len2 = strlen(s2 + 1);
  while (scanf("%d", &operation[n]) != EOF) {
    ++n;
  }
  n--;
  for (register int i = 1; i <= len2; i++) book[int(s2[i])] = true;
  fuc(1, n);
  printf("%d\n", ans);
  return 0;
}
