#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
const int maxn = 2e5 + 7, maxm = 2e6 + 10;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const double PI = acos(-1.0);
int casn, n, m, k;
int x[maxn];
string a, b;
int vis[maxn];
int check(int mid) {
  memset(vis, 0, sizeof vis);
  for (int i = 0; i <= mid - 1; ++i) vis[x[i]] = 1;
  int pos = 0;
  for (int i = 0; i <= n - 1; ++i) {
    if (vis[i]) continue;
    if (a[i] == b[pos]) pos++;
    if (pos == m) return 1;
  }
  return 0;
}
int main() {
  cin >> a >> b;
  n = a.size(), m = b.size();
  for (int i = 0; i <= n - 1; ++i) cin >> x[i], x[i]--;
  int l = 0, r = n;
  int ans = 0;
  while (l < r) {
    int mid = (l + r) >> 1;
    if (check(mid))
      ans = mid, l = mid + 1;
    else
      r = mid;
  }
  cout << ans << '\n';
  return 0;
}
