#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e6 + 5;
const int M = (int)1e9 + 7;
string s, t;
int n, a[N];
bool check(int x) {
  vector<int> cn(n + 5);
  for (int i = 1; i <= x; ++i) {
    cn[a[i]] = 1;
  }
  string g;
  for (int i = 0; i < n; ++i) {
    if (cn[i + 1]) {
      continue;
    }
    g += s[i];
  }
  int j = 0;
  for (int i = 0; i < (int)g.size(); ++i) {
    if (g[i] == t[j]) {
      ++j;
    }
    if (j == (int)t.size()) {
      return 1;
    }
  }
  return 0;
}
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> s >> t;
  n = (int)s.size();
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  int l = 1, r = n, ans = 0;
  while (r >= l) {
    int mid = (l + r) / 2;
    if (check(mid)) {
      l = mid + 1;
      ans = mid;
    } else {
      r = mid - 1;
    }
  }
  cout << ans;
  return 0;
}
