#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long inf = 1LL << 62;
const long long mx = 100005;
const double eps = 1e-10;
long long dx[10] = {1, 0, -1, 0};
long long dy[10] = {0, -1, 0, 1};
long long power(long long a, long long b) {
  if (b == 0) return 1;
  long long x = power(a, b / 2);
  x = x * x;
  if (b % 2) x = x * a;
  return x;
}
long long bigmod(long long a, long long b) {
  if (b == 0) return 1;
  long long x = bigmod(a, b / 2) % mod;
  x = (x * x) % mod;
  if (b % 2) x = (x * a) % mod;
  return x;
}
long long Set(long long N, long long pos) { return N = N | (1LL << pos); }
long long reset(long long N, long long pos) { return N = N & ~(1LL << pos); }
bool check(long long N, long long pos) { return (bool)(N & (1LL << pos)); }
long long arr[2 * mx], ck[2 * mx];
int main() {
  long long tst, a, b, c, k, n, m, res = 0, ans = 0;
  string t, p;
  cin >> t >> p;
  n = (long long)(t).size();
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &arr[i]);
    arr[i]--;
  }
  long long lo = 0, hi = n, mid;
  while (lo <= hi) {
    mid = (lo + hi) / 2;
    string str;
    memset(ck, 0, sizeof(ck));
    for (long long i = 1; i <= mid; i++) {
      ck[arr[i]] = 1;
    }
    for (long long i = 0; i < (long long)(t).size(); i++) {
      if (ck[i]) continue;
      str.push_back(t[i]);
    }
    long long j = 0;
    a = 0;
    for (long long i = 0; i < (long long)(str).size(); i++) {
      if (str[i] == p[j]) {
        j++;
      }
      if (j == (long long)(p).size()) {
        a = 1;
        break;
      }
    }
    if (a) {
      lo = mid + 1;
      res = max(res, mid);
    } else {
      hi = mid - 1;
    }
  }
  cout << res << "\n";
  return 0;
}
