#include <bits/stdc++.h>
using namespace std;
bool check(string s, string sub, vector<int> arr, int mid) {
  string tmp = s;
  for (int i = 1; i <= mid; i++) {
    tmp[arr[i] - 1] = '$';
  }
  int j = 0;
  for (int i = 0; i < tmp.size(); i++) {
    if (tmp[i] == sub[j]) j++;
    if (j == sub.size()) return true;
  }
  return false;
}
int count_removals(string s, string sub, vector<int> arr) {
  int low = 0, high = arr.size(), mid;
  while (high - low > 1) {
    mid = (low + high) / 2;
    if (check(s, sub, arr, mid)) {
      low = mid;
    } else {
      high = mid;
    }
  }
  return check(s, sub, arr, high) ? high : low;
}
int main() {
  string s, sub;
  cin >> s >> sub;
  vector<int> arr(s.size() + 1);
  int tmp;
  for (int i = 1; i <= s.size(); i++) {
    cin >> tmp;
    arr[i] = tmp;
  }
  cout << count_removals(s, sub, arr);
  return 0;
}
