#include <bits/stdc++.h>
const double pi = std::acos(-1);
using namespace std;
const long long int mod = 1000000000 + 7;
long long int power(long long int x, long long int y, long long int md) {
  long long int res = 1;
  x = x % md;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % md;
    y = y >> 1;
    x = (x * x) % md;
  }
  return res;
}
long long int m_mul(long long int a, long long int b) {
  a = a % mod;
  b = b % mod;
  return (a * b + mod) % mod;
}
long long int m_add(long long int a, long long int b) {
  a = a % mod;
  b = b % mod;
  return (a + b + mod) % mod;
}
long long int spf[(long long int)1e7 + 2] = {0};
void siv() {
  spf[1] = 1;
  for (long long int i = 1; i < 1e7 + 2; i++) spf[i] = i;
  for (long long int i = 2; i < 1e7 + 2; i++) spf[i] = 2, i++;
  for (long long int i = 3; i * i < (long long int)1e7 + 2; i++) {
    if (spf[i] == i)
      for (long long int j = i * i; j < (long long int)1e7 + 2; j = j + i)
        if (spf[j] == j) spf[j] = i;
  }
}
long long int ch(string s1, string s2, long long int mid, long long int arr[]) {
  long long int i = 0;
  long long int j = 0;
  for (long long int i = 0; i < mid + 1; i++) {
    s1[arr[i] - 1] = '0';
  }
  while (i < s1.size()) {
    if (s2[j] == s1[i]) {
      j++;
    }
    i++;
    if (j == s2.size()) return 1;
  }
  return 0;
}
int main() {
  long long int tc = 1;
  while (tc--) {
    long long int n;
    string s, s2;
    cin >> s >> s2;
    n = s.size();
    long long int arr[n];
    for (long long int i = 0; i < n; i++) cin >> arr[i];
    long long int i = 0, j = n - 1;
    long long int ind = -1;
    long long int mid = 0;
    while (i <= j) {
      mid = (i + j) / 2;
      if (ch(s, s2, mid, arr) == 1) {
        i = mid + 1;
        ind = mid;
      } else {
        j = mid - 1;
      }
    }
    cout << ind + 1 << '\n';
  }
  return 0;
}
