#include <bits/stdc++.h>
using namespace std;
string s, t;
int sz, patokan;
int arr[200005];
bool valid(int x) {
  priority_queue<int, vector<int>, greater<int> > pq;
  int idx = 0;
  for (int i = x + 1; i <= sz; i++) {
    pq.push(arr[i]);
  }
  while (!pq.empty()) {
    int z = pq.top();
    pq.pop();
    if (idx == patokan) break;
    if (s[z - 1] == t[idx]) {
      idx++;
    }
  }
  return idx == patokan;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> s >> t;
  sz = s.size();
  patokan = t.size();
  for (int i = 1; i <= sz; i++) {
    cin >> arr[i];
  }
  int ki = 1, ka = sz;
  int pos = 0;
  while (ki <= ka) {
    int mid = (ki + ka) / 2;
    if (valid(mid)) {
      pos = mid;
      ki = mid + 1;
    } else
      ka = mid - 1;
  }
  cout << pos << endl;
}
