#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s1, s2;
  cin >> s1 >> s2;
  long long l = s1.length();
  long long l1 = s2.length();
  long long a[l + 1];
  for (long long i = 1; i <= l; i++) {
    cin >> a[i];
  }
  map<long long, long long> mp;
  long long ans = 0;
  long long le = 0, rt = l;
  while (le <= rt) {
    long long mid = (le + rt) / 2;
    mp.clear();
    for (long long i = 1; i <= mid; i++) {
      mp[a[i] - 1]++;
    }
    long long i = 0, j = 0;
    while (i < l and j < l1) {
      if (s1[i] == s2[j] and mp[i] == 0) {
        i++;
        j++;
      } else {
        i++;
      }
    }
    if (j == l1) {
      ans = mid;
      le = mid + 1;
    } else {
      rt = mid - 1;
    }
  }
  cout << ans << '\n';
  return 0;
}
