#include <bits/stdc++.h>
using namespace std;
long long n, m;
vector<long long> arr;
string b, e;
bool sub(int s) {
  vector<int> nt(n);
  for (int i = 0; i < s; i++) nt[arr[i] - 1] = 1;
  int ei = 0;
  for (int i = 0; i < n; i++) {
    if (!nt[i]) {
      if (e[ei] == b[i]) ei++;
      if (ei == m) return true;
    }
  }
  return false;
}
void solve() {
  cin >> b >> e;
  n = b.size();
  m = e.size();
  arr.resize(n);
  for (int i = 0; i < n; i++) cin >> arr[i];
  int l = 0, r = n;
  while (l <= r) {
    int mid = (l + r) / 2;
    if (sub(mid)) {
      l = mid + 1;
    } else {
      r = mid - 1;
    }
  }
  cout << r;
}
int main() {
  int t = 1;
  while (t--) {
    solve();
    cout << "\n";
  }
  return 0;
}
