#include <bits/stdc++.h>
using namespace std;
string s, t;
int a;
vector<int> tot;
bool check(int len) {
  string g = s;
  for (int i = 0; i < len; i++) {
    g[tot[i] - 1] = '.';
  }
  int j = 0;
  for (auto it : g) {
    if (it == t[j]) j++;
    if (j == t.length()) break;
  }
  return j == t.length();
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> s >> t;
  for (int i = 0; i < s.length(); i++) {
    cin >> a;
    tot.push_back(a);
  }
  int l = 0;
  int r = s.length();
  int ans = -1;
  while (l <= r) {
    int mid = l + r;
    mid /= 2;
    if (check(mid)) {
      ans = mid;
      l = mid + 1;
    } else
      r = mid - 1;
  }
  cout << ans << '\n';
  return 0;
}
