#include <bits/stdc++.h>
using namespace std;
long long a[200001], n;
string s, t;
bool check(long long m) {
  string temp = s;
  for (long long i = 0; i < m; ++i) {
    temp[a[i] - 1] = '.';
  }
  long long i = 0, j = 0;
  while (i < n && j < t.size()) {
    if (temp[i] == '.') {
      ++i;
      continue;
    } else if (temp[i] == t[j]) {
      ++i;
      ++j;
    } else
      ++i;
  }
  return j == t.size();
}
void solve() {
  cin >> s >> t;
  n = s.size();
  for (long long i = 0; i < n; ++i) cin >> a[i];
  long long l = 0, r = n, m, ans = 0;
  while (l <= r) {
    m = l + (r - l) / 2;
    if (check(m)) {
      ans = max(ans, m);
      l = m + 1;
    } else {
      r = m - 1;
    }
  }
  cout << ans << "\n";
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) solve();
  return 0;
}
