#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 9;
string s, e;
int a[maxn], n, m;
bool vis[maxn];
bool ok(int mid) {
  memset(vis, 0, sizeof(vis));
  for (int i = 0; i < mid; i++) {
    vis[a[i] - 1] = 1;
  }
  int j = 0;
  for (int i = 0; i < n; i++) {
    if (!vis[i] && e[j] == s[i]) {
      j++;
    }
  }
  return j == m ? true : false;
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> s >> e;
  n = s.size();
  m = e.size();
  for (int i = 0; i < n; i++) cin >> a[i];
  int l = -1, r = n;
  while (l <= r) {
    int mid = l + r >> 1;
    if (ok(mid))
      l = mid + 1;
    else
      r = mid - 1;
  }
  cout << r << endl;
  return 0;
}
