#include <bits/stdc++.h>
using namespace std;
long long n, i, b, f, f1, o, m, q, err, x, ans, qeqs, col, last, o1, j,
    mx = -1, Q, l, r, c;
long long a[300000];
string s, s2;
bool can(long long k) {
  string s1 = s;
  for (long long i = 0; i < k; ++i) {
    s1[a[i] - 1] = '~';
  }
  long long q = 0, i1 = 0;
  while (q != s2.size()) {
    while (s1[i1] != s2[q] && i1 <= s1.size() - 1) i1++;
    if (i1 >= s1.size()) break;
    if (s1[i1] == s2[q]) q++, i1++;
  }
  if (q == s2.size()) return true;
  return false;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> s >> s2;
  for (i = 0; i < s.size(); ++i) {
    cin >> a[i];
  }
  l = 0;
  r = s.size();
  while (l < r) {
    o++;
    if (o > 50) cout << 1 / 0 << endl;
    c = (l + r + 1) / 2;
    if (can(c))
      l = c + 1;
    else
      r = c - 1;
  }
  while (!can(l)) l--;
  cout << l << endl;
  return 0;
}
