#include <bits/stdc++.h>
using namespace std;
int a[200005], del[200005];
string s1, s2;
bool check(int x) {
  int i, j;
  for (i = 0; i < s1.length(); i++) {
    del[i] = 0;
  }
  for (i = 0; i < x; i++) {
    del[a[i]] = 1;
  }
  for (i = 0, j = 0; i < s1.length(); i++) {
    if (!del[i] && s1[i] == s2[j]) {
      j++;
    }
    if (j == s2.length()) return true;
  }
  return false;
}
int main() {
  cin >> s1 >> s2;
  for (int i = 0; i < s1.length(); i++) {
    cin >> a[i];
    a[i]--;
  }
  int l = 0;
  int r = s1.length() - 1;
  while (l <= r) {
    int m = (l + r) / 2;
    if (check(m))
      l = m + 1;
    else
      r = m - 1;
  }
  cout << l - 1;
  return 0;
}
