#include <bits/stdc++.h>
using namespace std;
string rem(string s, vector<int> v, int x) {
  int i = 0;
  while (x > 0) {
    s[v[i] - 1] = '.';
    x--;
    i++;
  }
  return s;
}
bool check(string s, string t) {
  string::iterator it1, it2;
  it1 = s.begin();
  it2 = t.begin();
  while (it1 != s.end()) {
    if (*it1 == *it2) {
      it1++;
      it2++;
    } else {
      it1++;
    }
  }
  if (it2 == t.end())
    return 1;
  else
    return 0;
}
int main() {
  string s;
  string t;
  cin >> s;
  cin >> t;
  vector<int> v;
  string sc;
  for (int i = 0; i < s.length(); i++) {
    int x;
    cin >> x;
    v.push_back(x);
  }
  int mx = s.length();
  int mn = 0;
  while (mn < mx) {
    sc = s;
    int md = (mx + mn) / 2;
    sc = rem(sc, v, md);
    bool k = check(sc, t);
    if (k == 1) {
      mn = md + 1;
    } else {
      mx = md;
    }
  }
  cout << mn - 1;
}
