#include <bits/stdc++.h>
using namespace std;
int l1, l2, opt[200010];
char t[200010], p[200010];
bool f[200010];
bool test(int k) {
  for (int i = 1; i <= l1; i++) f[i] = 1;
  for (int i = 1; i <= k; i++) f[opt[i]] = 0;
  int l = 1;
  for (int i = 1; i <= l1; i++)
    if (f[i] && t[i] == p[l]) {
      l++;
      if (l > l2) break;
    }
  if (l > l2)
    return true;
  else
    return false;
}
int main() {
  scanf("%s", t + 1);
  l1 = strlen(t + 1);
  scanf("%s", p + 1);
  l2 = strlen(p + 1);
  for (int i = 1; i <= l1; i++) scanf("%d", &opt[i]);
  int L = 0, R = l1 - l2, ans = 0;
  while (L <= R) {
    int mid = (L + R) >> 1;
    if (test(mid)) {
      L = mid + 1;
      ans = mid;
    } else
      R = mid - 1;
  }
  printf("%d\n", ans);
  return 0;
}
