#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
string p, t;
int a[N], sz;
bool check(int st) {
  vector<int> vec;
  for (int i = st; i < sz; i++) vec.push_back(a[i] - 1);
  sort(vec.begin(), vec.end());
  string tt = "";
  for (auto i : vec) tt += p[i];
  int i, j;
  for (i = 0, j = 0; i < (int)tt.size(); i++) {
    if (j < (int)t.size() && tt[i] == t[j]) j++;
  }
  return j == (int)t.size();
}
int main(void) {
  cin >> p >> t;
  sz = (int)p.size();
  for (int i = 0; i < sz; i++) scanf("%d", &a[i]);
  int l = 0, r = sz - 1, ans;
  while (l <= r) {
    int mid = l + r >> 1;
    if (check(mid))
      l = mid + 1, ans = mid;
    else
      r = mid - 1;
  }
  cout << ans << endl;
  return 0;
}
void bef0re_submit() {
  puts("Make sure the algorithm is right!");
  puts("LONG LONG!!!");
  puts("Check n and m are misuesd???");
  puts("Make sure output format is right/// Yes??YES  (%.20LF)???");
  puts("if all meet,run with special situation!!!");
  puts("I confirm that I have done all above");
}
