#include <bits/stdc++.h>
using namespace std;
bool check(vector<int> ind, string a, string b, int i, int n) {
  int z, k = 0, m = b.length();
  for (int j = 0; j <= i; j++) {
    z = ind[j];
    a[z - 1] = '0';
  }
  for (int j = 0; j < n; j++) {
    if (a[j] == b[k]) k++;
    if (k == m) return true;
  }
  return false;
}
int solve(vector<int> ind, string a, string b, int n) {
  int l = 0, r = n - 1, m;
  while (l < r) {
    m = l + (r - l + 1) / 2;
    if (check(ind, a, b, m, n))
      l = m;
    else
      r = m - 1;
  }
  if (l == 0) {
    if (check(ind, a, b, l, n))
      return l + 1;
    else
      return 0;
  }
  return l + 1;
}
int main() {
  string a, b;
  cin >> a >> b;
  vector<int> ind;
  int n = a.length(), x;
  for (int i = 0; i < n; i++) {
    cin >> x;
    ind.push_back(x);
  }
  cout << solve(ind, a, b, n);
  return 0;
}
