#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
long long pw(long long a, long long b) {
  long long r = 1;
  while (b > 0) {
    if (b & 1) {
      r = (r * a) % MOD;
    }
    b = b >> 1;
    a = (a * a) % MOD;
  }
  return (r) % MOD;
}
string a, b;
int cross[201000] = {};
int n;
vector<int> op;
int fun(int len) {
  int pos = 0;
  memset(cross, 0, sizeof(cross));
  for (int i = 0; i < len; i++) {
    cross[op[i]] = 1;
  }
  for (int i = 0; i < n; i++) {
    if (!cross[i]) {
      if (a[i] == b[pos]) {
        pos++;
      }
    }
    if (pos == b.size()) {
      return 1;
    }
  }
  return 0;
}
int main() {
  cin >> a >> b;
  n = a.size();
  int first;
  for (int i = 0; i < n; i++) {
    scanf("%d", &first);
    op.push_back(first - 1);
  }
  int ans = -1;
  int l = 0, r = n, mid;
  while (l <= r) {
    mid = (l + r) / 2;
    if (fun(mid)) {
      ans = mid;
      l = mid + 1;
    } else {
      r = mid - 1;
    }
  }
  cout << ans;
  printf("\n");
  return 0;
}
