#include <bits/stdc++.h>
using namespace std;
int a[200005], removed[200005];
string t, p;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> t >> p;
  for (int i = 1; i <= ((int)(t).size()); ++i) cin >> a[i], a[i]--;
  int l = 0, r = ((int)(t).size()), ans = 0;
  while (l <= r) {
    int m = (l + r) / 2;
    for (int i = 0; i < ((int)(t).size()); ++i) removed[i] = 0;
    for (int i = 1; i <= m; ++i) removed[a[i]] = 1;
    string s = "";
    for (int i = 0; i < ((int)(t).size()); ++i)
      if (!removed[i]) s += t[i];
    int j = 0;
    for (int i = 0; i < ((int)(s).size()) && j < ((int)(p).size()); ++i)
      if (s[i] == p[j]) j++;
    if (j == ((int)(p).size())) {
      ans = m;
      l = m + 1;
    } else
      r = m - 1;
  }
  cout << ans;
  return 0;
}
