#include <bits/stdc++.h>
using namespace std;
int idx[200010];
string s, p;
bool is[200010];
bool tryk(int k) {
  for (int i = 0; i < s.size(); ++i) is[i] = 0;
  for (int i = 0; i < k; ++i) is[idx[i] - 1] = 1;
  string test;
  for (int i = 0; i < s.size(); ++i) {
    if (!is[i]) test.push_back(s[i]);
  }
  int findx = 0;
  for (int i = 0; i < test.size(); ++i) {
    if (findx != p.size() && test[i] == p[findx]) findx++;
  }
  return findx == p.size();
}
int main() {
  cin >> s;
  cin >> p;
  for (int i = 0; i < s.size(); ++i) {
    scanf("%d", &idx[i]);
  }
  int l = 0, r = s.size(), mid;
  while (l < r - 1) {
    mid = (l + r) / 2;
    if (tryk(mid)) {
      l = mid;
    } else {
      r = mid;
    }
  }
  printf("%d", l);
}
