#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const long double EPS = 1e-7;
string t, p;
vector<long long> a;
bool check(long long cnt_del) {
  vector<bool> used((signed)t.size(), false);
  for (long long i = 0; i < cnt_del; ++i) {
    used[a[i]] = true;
  }
  string s;
  for (long long i = 0; i < (signed)t.size(); ++i) {
    if (!used[i]) {
      s.push_back(t[i]);
    }
  }
  long long ptr = 0;
  for (char c : s) {
    if (c == p[ptr]) {
      ++ptr;
      if (ptr == (signed)p.size()) {
        return true;
      }
    }
  }
  return false;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> t >> p;
  a.resize((signed)t.size());
  for (long long& it : a) {
    cin >> it;
    --it;
  }
  long long l = 0, r = (signed)t.size();
  while (r - l > 1) {
    long long m = (l + r) / 2;
    if (!check(m)) {
      r = m;
    } else {
      l = m;
    }
  }
  cout << l << endl;
  return 0;
}
