#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long> > v;
bool isSubSequence(string str1, string str2, int m, int n) {
  int j = 0;
  for (int i = 0; i < n && j < m; i++)
    if (str1[j] == str2[i]) j++;
  return (j == m);
}
int main() {
  string s1, s2, s3;
  cin >> s1 >> s2;
  int n = s1.length(), m = s2.length();
  long long ar[n], i, ans, l, r, mid;
  for (i = 0; i < n; ++i) cin >> ar[i];
  l = 0, r = n - 1;
  while (l <= r) {
    mid = (l + r) / 2;
    s3 = s1;
    for (i = 0; i < mid; ++i) s3[ar[i] - 1] = '_';
    if (isSubSequence(s2, s3, m, n)) {
      ans = mid;
      l = mid + 1;
    } else {
      r = mid - 1;
    }
  }
  cout << ans << endl;
  return 0;
}
