#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
void solve() {
  string t, p;
  cin >> t >> p;
  int n = t.size();
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    v[i]--;
  }
  int lo = 0, hi = n - p.size();
  while (lo < hi) {
    int mid = lo + (hi - lo + 1) / 2;
    vector<bool> visited(n, false);
    for (int i = 0; i < mid; i++) visited[v[i]] = true;
    int idx1 = 0, idx2 = 0;
    while (idx1 < t.size() && idx2 < p.size()) {
      while (visited[idx1]) idx1++;
      if (t[idx1] == p[idx2]) {
        idx2++;
        idx1++;
      } else {
        idx1++;
      }
    }
    if (idx2 == p.size()) {
      lo = mid;
    } else
      hi = mid - 1;
  }
  cout << lo << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tests = 1;
  while (tests--) {
    solve();
  }
}
