#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
char a[N], b[N];
int t[N];
bool vis[N];
bool Judge(int mid) {
  memset(vis, 0, sizeof(vis));
  for (int i = 0; i <= mid; i++) vis[t[i] - 1] = 1;
  int cnt = 0;
  int len1 = strlen(a);
  int len2 = strlen(b);
  for (int i = 0; i < len1; i++) {
    if (vis[i] == 0 && a[i] == b[cnt]) {
      cnt++;
    }
  }
  if (cnt == len2)
    return 1;
  else
    return 0;
}
int main() {
  cin >> a;
  cin >> b;
  int lena = strlen(a);
  int lenb = strlen(b);
  int r = lena - 1;
  int l = 0;
  int ans = -1;
  for (int i = 0; i < lena; i++) cin >> t[i];
  while (r - l >= 0) {
    int mid = (l + r) / 2;
    if (Judge(mid)) {
      l = mid + 1;
      ans = mid;
    } else
      r = mid - 1;
  }
  cout << ans + 1 << endl;
}
