#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
const long long int INF = 3e18;
const double EPSILON = 1e-9;
const int N = 200005;
int main() {
  cout.tie(NULL), cin.tie(NULL), cout.sync_with_stdio(false);
  ;
  string s, t;
  cin >> s >> t;
  int n = (int)s.size();
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  auto tryy = [&](int pos) {
    vector<int> apagado(N);
    for (int i = 0; i <= pos; i++) apagado[v[i] - 1] = 1;
    int j = 0;
    for (int i = 0; i < n; i++) {
      if (!apagado[i] and s[i] == t[j]) {
        j++;
      }
    }
    return (j == (int)t.size());
  };
  int l = 0, r = n - 1, mid, ans = -1;
  while (l <= r) {
    mid = (l + r) / 2;
    if (tryy(mid)) {
      ans = mid;
      l = mid + 1;
    } else
      r = mid - 1;
  }
  if (ans == -1)
    ans = 0;
  else
    ans++;
  cout << ans << "\n";
  return 0;
}
