#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const double EPS = 1e-8;
const double PI = acos(-1.0);
const int MOD = 1e9 + 7;
const long long LINF = 3e18;
int n;
string s, p;
vector<int> a;
bool check(int x) {
  vector<bool> m(n, false);
  for (int i = 0; i < x; i++) {
    m[a[i]] = true;
  }
  string c = "";
  for (int i = 0; i < n; i++) {
    if (!m[i]) c += s[i];
  }
  int p1 = 0, p2 = 0;
  while (p1 < c.size() && p2 < p.size()) {
    if (c[p1] == p[p2]) {
      p2++;
    }
    p1++;
  }
  return p2 == p.size();
}
int main() {
  cin >> s >> p;
  n = s.size();
  a.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i]--;
  }
  int l = 0, r = n;
  while (r - l > 1) {
    int m = (l + r) / 2;
    if (check(m))
      l = m;
    else
      r = m;
  }
  if (check(r)) l = r;
  cout << l;
  return 0;
}
