#include <bits/stdc++.h>
using namespace std;
string s, t;
int N, M;
int p[200005];
bool check(int k) {
  vector<bool> v(N, 1);
  for (int i = (1), _b = (k); i <= _b; i++) v[p[i]] = 0;
  int ptr = 0;
  for (int i = (0), _b = (N - 1); i <= _b; i++) {
    if (v[i] && s[i] == t[ptr]) ++ptr;
    if (ptr == M) return 1;
  }
  return 0;
}
int main(void) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> s >> t;
  N = s.size(), M = t.size();
  for (int i = (1), _b = (N); i <= _b; i++) cin >> p[i], --p[i];
  int L = 0, R = N - M;
  while (L < R) {
    int m = L + R + 1 >> 1;
    if (check(m))
      L = m;
    else
      R = m - 1;
  }
  cout << L << endl;
  return 0;
}
