#include <bits/stdc++.h>
using namespace std;
string a, b;
int d[10000009];
bool check(int m) {
  string c = a;
  int count = 0;
  for (int i = 0; i < m; i++) {
    c[d[i] - 1] = '8';
  }
  for (int i = 0; i < a.size(); i++) {
    if (c[i] == b[count]) count++;
    if (b.size() == count) return true;
  }
  return false;
}
int main() {
  cin >> a >> b;
  for (int i = 0; i < a.size(); i++) {
    cin >> d[i];
  }
  int low = 0, high = a.size(), mid = (low + high) / 2;
  while (high > low + 1) {
    if (check(mid))
      low = mid;
    else
      high = mid;
    mid = (low + high) / 2;
  }
  cout << mid;
  return 0;
}
