#include <bits/stdc++.h>
const int maxn = 200005;
using namespace std;
int vis[maxn];
int k[maxn];
char a[maxn], b[maxn];
int main() {
  scanf("%s%s", a, b);
  int lena = strlen(a);
  int lenb = strlen(b);
  for (int i = 1; i <= lena; i++) scanf("%d", &k[i]);
  int l = 0, r = lena, ans = 0;
  while (l <= r) {
    int mid = (l + r) / 2;
    int w = 0;
    memset(vis, 0, sizeof(vis));
    for (int i = 1; i <= mid; i++) vis[k[i] - 1] = 1;
    for (int i = 0; i < lena && w < lenb; i++) {
      if (!vis[i] && a[i] == b[w]) w++;
    }
    if (w == lenb) {
      ans = mid;
      l = mid + 1;
    } else
      r = mid - 1;
  }
  printf("%d", ans);
  return 0;
}
