#include <bits/stdc++.h>
using namespace std;
long long n, m;
vector<long long> arr;
string b, e;
bool sub(int s) {
  set<int> id;
  for (int i = s; i < n; i++) id.insert(arr[i]);
  int ei = 0;
  for (auto i = id.begin(); i != id.end(); i++) {
    if (e[ei] == b[*i - 1]) ei++;
    if (ei == m) return true;
  }
  return false;
}
void solve() {
  cin >> b >> e;
  n = b.size();
  m = e.size();
  arr.resize(n);
  for (int i = 0; i < n; i++) cin >> arr[i];
  int l = 0, r = n;
  while (l <= r) {
    int mid = (l + r) / 2;
    if (sub(mid)) {
      l = mid + 1;
    } else {
      r = mid - 1;
    }
  }
  cout << r;
}
int main() {
  int t = 1;
  while (t--) {
    solve();
    cout << "\n";
  }
  return 0;
}
