#include <bits/stdc++.h>
using namespace std;
int arr[200005];
bool check(string a, string b) {
  int cur = 0;
  int n = a.size();
  for (int i = 0; i < n; i++) {
    if (a[i] == b[cur]) {
      cur++;
    }
  }
  if (cur == b.size()) return true;
  return false;
}
int main() {
  int n, k;
  string a, b;
  cin >> a >> b;
  for (int i = 0; i < a.size(); i++) {
    cin >> arr[i];
  }
  int l = 0;
  int h = a.size();
  bool ans = false;
  int cur = 0;
  while (l < h) {
    int mid = (l + h) >> 1;
    if (l == mid) mid++;
    string temp = "";
    int vis[a.size() + 1];
    memset(vis, 0, sizeof vis);
    for (int i = 0; i < mid; i++) vis[arr[i]] = 1;
    for (int i = 0; i < a.size(); i++) {
      if (!vis[i + 1]) temp += a[i];
    }
    ans = check(temp, b);
    if (ans) {
      l = mid;
    } else {
      h = mid - 1;
    }
  }
  cout << l << "\n";
}
