#include <bits/stdc++.h>
using namespace std;
string a, b;
int l, r, med;
int solve(vector<int> p1, int d) {
  string a1;
  r = d;
  while (l + 1 < r) {
    int i = 0, j = 0;
    a1 = a;
    med = (l + r) / 2;
    while (i < med) {
      a1[p1[i] - 1] = '*';
      i++;
    }
    i = 0;
    while (j < d) {
      if (b[i] == a1[j]) {
        i++;
      }
      j++;
    }
    if (i == b.size()) {
      l = med;
    } else {
      r = med;
    }
  }
  return l;
}
int main() {
  cin >> a >> b;
  int a_size = a.size();
  vector<int> p(a_size);
  for (int i = 0; i < a_size; i++) {
    cin >> p[i];
  }
  cout << solve(p, a_size);
  return 0;
}
