#include <bits/stdc++.h>
using namespace std;
string s1, s2;
int a[200002];
bool check(int pos) {
  string s = s1;
  for (int i = 0; i < pos; ++i) s[a[i] - 1] = '.';
  int ptr1 = 0, ptr2 = 0;
  while (ptr1 != s1.size() && ptr2 != s2.size()) {
    if (s[ptr1] == s2[ptr2])
      ++ptr1, ++ptr2;
    else
      ++ptr1;
  }
  return (ptr2 == s2.size());
}
int main() {
  cin >> s1 >> s2;
  int i, lb = 0, ub = s1.size(), mid = -1;
  for (i = 0; i < s1.size(); ++i) cin >> a[i];
  while (lb <= ub) {
    mid = (lb + ub) / 2;
    if (check(mid) == false)
      ub = mid - 1;
    else if (check(mid + 1) == true)
      lb = mid + 1;
    else {
      cout << mid << endl;
      return 0;
    }
  }
  cout << 0 << endl;
  return 0;
}
