#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-10;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
const long double PI = 3.1415926535897932384626433832795028841;
map<string, int> ssol;
void checkAdd(string vs) {
  if (ssol.find(vs) != ssol.end()) {
    return;
  }
  ssol[vs] = 1;
}
bool TST = 0;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= MOD;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % MOD;
    a = a * a % MOD;
  }
  return res;
}
void Show(int *QQ, int N) {
  if (not TST) {
    return;
  }
  for (int x = 0; x < N; x++) {
    cout << QQ[x];
    if (x != N - 1) {
      cout << ',';
    }
  }
  cout << '\n';
}
void ShowLL(long long *QQ, int N) {
  if (not TST) {
    return;
  }
  for (int x = 0; x < N; x++) {
    cout << QQ[x];
    if (x != N - 1) {
      cout << ',';
    }
  }
  cout << '\n';
}
const int maxn = 1e5 * 3;
const int maxm = 100005;
const int maxk = 100005;
string t, p;
int lk[maxn];
int a[maxn];
int valid[maxn];
int pn, n;
bool pos(int h) {
  for (int i = 0; i < n; i++) valid[a[i]] = i >= h;
  int cur = 0;
  for (int i = 0; i < n; i++) {
    if (not valid[i]) continue;
    if (t[i] == p[cur]) {
      cur++;
      if (cur == pn) return 1;
    }
  }
  return 0;
}
int main() {
  cin >> t >> p;
  n = t.size();
  pn = p.size();
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i]--;
  }
  int A = 0;
  int B = n;
  while (A + 1 != B) {
    int h = (A + B) / 2;
    if (pos(h) == 1) {
      A = h;
    } else {
      B = h;
    }
  }
  cout << A << '\n';
}
