#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
char str1[maxn], str2[maxn];
int a[maxn], len1, len2;
bool book[maxn];
bool judge(int x) {
  for (int i = 1; i <= x; i++) book[a[i] - 1] = 1;
  int j = 0, cnt = 0;
  for (int i = 0; i < len2; i++) {
    for (; j < len1; j++) {
      if (str2[i] == str1[j] && !book[j]) {
        j++;
        cnt++;
        break;
      }
    }
  }
  return cnt == len2;
}
int main(void) {
  while (~scanf(" %s %s", str1, str2)) {
    len1 = strlen(str1);
    len2 = strlen(str2);
    for (int i = 1; i <= len1; i++) scanf("%d", &a[i]);
    int l = 0, r = len1, ans;
    while (l <= r) {
      memset(book, 0, sizeof(book));
      int mid = (l + r) / 2;
      if (judge(mid))
        l = mid + 1, ans = mid;
      else
        r = mid - 1;
    }
    printf("%d\n", ans);
  }
  return 0;
}
