#include <bits/stdc++.h>
using namespace std;
string s1, s2;
long long int m, n;
long long int a[200005];
bool check(long long int x) {
  vector<bool> p(n, true);
  for (long long int i = 0; i <= x; ++i) p[a[i]] = false;
  long long int j = 0;
  for (long long int i = 0; i < n && j < m; i++) {
    if (p[i]) {
      if (s1[i] == s2[j]) j++;
    }
  }
  return (j == m);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> s1 >> s2;
  n = s1.length();
  m = s2.length();
  for (long long int i = 0; i <= n - 1; ++i) {
    cin >> a[i];
    a[i]--;
  }
  long long int low = 0;
  long long int high = n - 1;
  long long int mid;
  while (low < high) {
    mid = (low + high) / 2;
    if (check(mid))
      low = mid + 1;
    else
      high = mid;
  }
  cout << low;
}
