#include <bits/stdc++.h>
using namespace std;
int dx[] = {2, 1, -1, -2, -2, -1, 1, 2};
int dy[] = {1, 2, 2, 1, -1, -2, -2, -1};
const int MOD = 1e9 + 7;
const int N = 1e7 + 5;
long long n, m, k;
vector<int> v;
string s1, s2;
bool ok(int mid) {
  string s3 = s1;
  for (int i = 0; i < mid; i++) {
    s3[v[i]] = ' ';
  }
  int l = 0, r = 0;
  while (l < s3.size() && r < s2.size()) {
    if (s3[l] == s2[r]) {
      l++;
      r++;
      continue;
    } else
      l++;
  }
  if (r == s2.size()) return true;
  return false;
}
int main() {
  cin >> s1 >> s2;
  v.resize(s1.size());
  for (int i = 0; i < s1.size(); i++) {
    cin >> v[i];
    v[i]--;
  }
  int l = 0, r = s1.size(), ans = 0;
  while (l < r) {
    int mid = (l + r) / 2;
    if (ok(mid)) {
      l = mid + 1;
      ans = mid;
    } else
      r = mid - 1;
  }
  while (ok(ans)) ans++;
  ans--;
  cout << ans << endl;
}
