#include <bits/stdc++.h>
using namespace std;
const int maxn = 200000 + 10;
const int INF = 0x3f3f3f3f;
int a[maxn], pos[maxn];
string s, k;
bool check(int m) {
  int len = 0;
  memset(pos, 0, sizeof(pos));
  for (int i = 0; i < m; i++) {
    pos[a[i]] = 1;
  }
  int cnt = 0;
  for (int i = 0; i < s.size(); i++) {
    if (pos[i + 1] == 1) continue;
    if (s[i] == k[cnt]) cnt++;
    if (cnt == k.size()) break;
  }
  if (cnt == k.size())
    return 1;
  else
    return 0;
}
int main() {
  cin >> s >> k;
  int len = s.size();
  for (int i = 0; i < len; i++) {
    scanf("%d", &a[i]);
  }
  int l = 0, r = len;
  int ans = 0;
  while (l <= r) {
    int m = (l + r) >> 1;
    if (check(m)) {
      ans = m;
      l = m + 1;
    } else
      r = m - 1;
  }
  cout << ans << endl;
}
