#include <bits/stdc++.h>
using namespace std;
string a, b;
int x[200000];
bool can(int f) {
  string g = a;
  for (int i = 0; i < f; i++) {
    g[x[i] - 1] = ' ';
  }
  int w = 0;
  for (int i = 0; i < g.size(); i++) {
    if (g[i] == b[w]) w++;
    if (w == b.size()) break;
  }
  if (w == b.size())
    return 1;
  else
    return 0;
}
int main() {
  cin >> a >> b;
  for (int i = 0; i < a.size(); i++) cin >> x[i];
  int l = 0, mid, k = 0;
  ;
  int r = a.size() - 1;
  while (l <= r) {
    mid = (l + r) / 2;
    if (can(mid)) {
      k = mid;
      l = mid + 1;
    } else {
      r = mid - 1;
    }
  }
  cout << k << endl;
  return 0;
}
