#include <bits/stdc++.h>
using namespace std;
bool isSubSequence(string str1, string str2, int m, int n) {
  int j = 0;
  for (int i = 0; i < n && j < m; i++)
    if (str1[j] == str2[i]) j++;
  return (j == m);
}
int main() {
  string t, p;
  cin >> t >> p;
  int tlen = t.length();
  int plen = p.length();
  int a[tlen];
  for (int i = 0; i < tlen; i++) cin >> a[i];
  int l = -1, r = tlen - 1, mid = (l + r - 1) / 2;
  int x;
  int flag = 0, ans = 0;
  while (l <= r) {
    string temp;
    mid = l + (r - l) / 2;
    temp = t;
    for (int i = 0; i <= mid; i++) {
      flag = 0;
      temp[a[i] - 1] = '*';
    }
    if (isSubSequence(p, temp, plen, tlen)) {
      ans = mid;
      l = mid + 1;
    }
    if (!(isSubSequence(p, temp, plen, tlen))) {
      r = mid - 1;
    }
  }
  cout << ans + 1 << endl;
}
