#include <bits/stdc++.h>
using namespace std;
string rems(string s, long long n, vector<long long> perm) {
  if (n > s.size()) n = s.size();
  string s3 = s;
  for (long long i = 0; i < n; i++) {
    s3[perm[i] - 1] = '0';
  }
  return s3;
}
bool isSubsequence(string str1, string str2, long long n, long long m) {
  n += 1, m += 1;
  long long j = 0;
  for (long long i = 0; i < n && j < m; i++)
    if (str2[j] == str1[i]) j++;
  return (j == m);
}
signed main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  long long begtime = clock();
  ;
  string a, b;
  cin >> a >> b;
  auto p = a.size();
  vector<long long> perm(p);
  for (long long i = 0; i < p; i++) {
    cin >> perm[i];
  }
  long long lo = 0, hi = p;
  while (lo < hi) {
    long long mid = (lo + hi) / 2;
    string s2 = rems(a, mid, perm);
    if (lo == mid) {
      string lol = rems(a, hi, perm);
      string lol2 = rems(a, lo, perm);
      if (isSubsequence(lol, b, lol.size() - 1, b.size() - 1)) {
        cout << hi;
        exit(0);
      } else if (isSubsequence(lol2, b, lol2.size() - 1, b.size() - 1)) {
        cout << lo;
        exit(0);
      }
    }
    if (isSubsequence(s2, b, s2.size() - 1, b.size() - 1)) {
      lo = mid;
    } else {
      hi = mid - 1;
    }
  }
  cout << lo;
  long long endtime = clock();
  cerr << endl
       << "Time elapsed: " << (endtime - begtime) * 1000 / CLOCKS_PER_SEC
       << " ms";
  return 0;
}
