#include <bits/stdc++.h>
using namespace std;
string p, t;
int a[200010];
int order[200010];
bool can(int k) {
  int num = 0;
  memset(a, 0, sizeof(a));
  for (int i = 0; i <= k; i++) a[order[i] - 1] = 1;
  for (int i = 0; i < p.length(); i++) {
    if (num == t.length()) break;
    if (a[i] == 0 && t[num] == p[i]) num++;
  }
  return (num == t.length()) ? true : false;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  cin >> p >> t;
  int n = p.length();
  for (long long int i = 0; i < n; i++) cin >> order[i];
  int start = 0, end = n - 1, ans = 0;
  while (start <= end) {
    int mid = (start + end) / 2;
    bool m = can(mid);
    if (mid + 1 < n && m == true && can(mid + 1) == false) {
      ans = mid + 1;
      break;
    } else if (m == false)
      end = mid - 1;
    else {
      ans = max(mid + 1, ans);
      start = mid + 1;
    }
  }
  cout << ans << endl;
}
