#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int order[N], len1, len2;
char a[N], b[N], tmp[N];
bool check(int n) {
  for (int i = 1; i <= len1; i++) tmp[i] = a[i];
  for (int i = 1; i <= n; i++) tmp[order[i]] = '0';
  int j = 1;
  for (int i = 1; i <= len1; i++) {
    if (tmp[i] == b[j]) j++;
  }
  if (j > len2) return true;
  return false;
}
int main() {
  scanf("%s", a + 1);
  scanf("%s", b + 1);
  len1 = strlen(a + 1);
  len2 = strlen(b + 1);
  int cnt = 0;
  while (~scanf("%d", &order[++cnt]))
    ;
  cnt--;
  int l = 0, r = cnt, mid, ans = -1;
  while (l <= r) {
    mid = (l + r) / 2;
    if (check(mid))
      l = mid + 1, ans = mid;
    else
      r = mid - 1;
  }
  cout << ans;
  return 0;
}
