#include <bits/stdc++.h>
using namespace std;
bool check(string &s, string &p) {
  char cur = p[0];
  int j = 1;
  for (int i = 0; i < (int)s.size(); ++i) {
    if (s[i] == cur) {
      if (j == (int)p.size())
        return true;
      else {
        cur = p[j];
        ++j;
      }
    }
  }
  return false;
}
int a[200005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  string t, p;
  cin >> t >> p;
  for (int i = 0; i < (int)t.size(); ++i) {
    cin >> a[i];
    --a[i];
  }
  int l = 0, r = (int)t.size();
  while (r - l > 1) {
    int m = (r + l) / 2;
    string tmp = t;
    for (int i = 0; i < m; ++i) tmp[a[i]] = '#';
    bool ch = check(tmp, p);
    if (ch) {
      l = m;
    } else {
      r = m;
    }
  }
  cout << l << '\n';
  return 0;
}
