#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
char s1[MAXN], s2[MAXN];
int a[MAXN];
int len1, len2;
bool book[MAXN];
bool judge(int m) {
  memset(book, false, sizeof(book));
  for (int i = m; i <= len1; i++) {
    book[a[i]] = true;
  }
  int now = 1;
  for (int i = 1; i <= len1 && now <= len2; i++) {
    if (!book[i]) {
      continue;
    }
    if (s1[i] == s2[now]) {
      now++;
    }
  }
  return now > len2;
}
int main() {
  scanf("%s", s1 + 1);
  scanf("%s", s2 + 1);
  len1 = strlen(s1 + 1);
  len2 = strlen(s2 + 1);
  for (int i = 1; i <= len1; i++) {
    scanf("%d", &a[i]);
  }
  int l = 1, r = len1, ans = 1;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (judge(mid)) {
      l = mid + 1;
      ans = max(ans, mid);
    } else {
      r = mid - 1;
    }
  }
  printf("%d\n", ans - 1);
  return 0;
}
