#include <bits/stdc++.h>
using namespace std;
int TN = 1;
const int N = 2e5 + 10;
int a[N], t, p;
string s1, s2;
bool used[N];
bool can(int x) {
  int p1 = 0, ln = 0;
  for (int i = 0; i < x; i++) used[a[i] - 1] = 1;
  int i = 0;
  while (i < t) {
    if (used[i]) {
      i++;
      continue;
    }
    if (!used[i] && s1[i] == s2[p1]) {
      i++;
      p1++;
    } else
      i++;
  }
  for (int i = 0; i < N; i++) used[i] = 0;
  if (p1 == p) return true;
  return false;
}
void solve() {
  getline(cin, s1);
  getline(cin, s2);
  t = s1.length();
  p = s2.length();
  for (int i = 0; i < t; i++) cin >> a[i];
  int l = 0, r = t;
  while (l < r) {
    int m = (l + r) / 2;
    if (can(m + 1))
      l = m + 1;
    else
      r = m;
  }
  cout << l;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  while (TN--) solve();
  return 0;
}
