#include <bits/stdc++.h>
using namespace std;
int dx8[] = {0, 0, 1, -1, 1, -1, 1, -1};
int dy8[] = {-1, 1, 0, 0, -1, -1, 1, 1};
int dy[] = {1, -1, 0, 0};
int dx[] = {0, 0, 1, -1};
int X[6] = {0, 0, 0, -1, 0, 1};
int Y[6] = {0, 0, -1, 0, 1, 0};
int Z[6] = {1, -1, 0, 0, 0, 0};
using namespace std;
string s, t;
vector<int> v;
bool can(int mid) {
  string tmp = s;
  for (int i = 0; i < mid; i++) tmp[v[i] - 1] = '*';
  int p2 = 0;
  for (int i = 0; i < tmp.size(); i++) {
    if (t[p2] == tmp[i]) ++p2;
    if (p2 == t.size()) return 1;
  }
  return 0;
}
int main() {
  cin >> s >> t;
  v.resize(s.size());
  for (int i = 0; i < s.size(); i++) {
    scanf("%d", &v[i]);
  }
  int st = 0, en = s.size(), mid;
  while (st < en) {
    mid = st + (en - st) / 2;
    if (can(mid)) {
      st = mid + 1;
    } else {
      en = mid;
    }
  }
  printf("%d\n", st - 1);
}
