#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 2e5 + 5;
string p, t;
unsigned long long arr[N];
unsigned long long n;
bool check(unsigned long long k) {
  unordered_map<unsigned long long, bool> mp;
  for (long long i = (1); i <= (k); i++) {
    mp[arr[i]] = true;
  }
  string s = ".";
  for (long long i = (1); i <= (n); i++) {
    if (!mp[i]) s += p[i];
  }
  unsigned long long i = 1, j = 1;
  while (i <= s.size() - 1 && j <= t.size() - 1) {
    if (s[i] == t[j]) j++;
    i++;
  }
  return j == t.size();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  cin >> p >> t;
  n = p.size();
  p = '.' + p;
  t = '.' + t;
  for (long long i = (1); i <= (n); i++) cin >> arr[i];
  unsigned long long low = 0, high = n + 1;
  while (high - low > 1) {
    unsigned long long mid = (low + high) / 2;
    if (check(mid)) {
      low = mid;
    } else {
      high = mid;
    }
  }
  cout << low << "\n";
}
