#include <bits/stdc++.h>
using namespace std;
char s[200010], p[200010];
int a[200010];
int main() {
  scanf("%s", &s[1]);
  int n = strlen(s + 1);
  scanf("%s", &p[1]);
  int t = strlen(p + 1);
  int l = 0, r = n, ans;
  for (int i = 1; i <= n; i++) {
    int b;
    scanf("%d", &b);
    a[b] = i;
  }
  while (l + 1 < r) {
    int m = (l + r) >> 1;
    int i = 1, j = 1;
    while (i <= strlen(s + 1)) {
      if (a[i] <= m) {
        i++;
        continue;
      }
      if (s[i] == p[j]) {
        i++;
        j++;
      } else {
        i++;
      }
      if (j == strlen(p + 1) + 1) break;
    }
    if (j == strlen(p + 1) + 1)
      l = m;
    else
      r = m;
  }
  printf("%d\n", l);
  return 0;
}
