#include <bits/stdc++.h>
using namespace std;
bool used[200005];
int n, k, _rank[200005], tmp[200005];
bool compare_sa(int i, int j) {
  if (_rank[i] != _rank[j])
    return _rank[i] < _rank[j];
  else {
    int ri = i + k <= n ? _rank[i + k] : -1;
    int rj = j + k <= n ? _rank[j + k] : -1;
    return ri < rj;
  }
}
void construct_sa(string s, int *sa) {
  n = s.size();
  for (int i = 0; i <= n; i++) {
    sa[i] = i;
    _rank[i] = i < n ? s[i] : -1;
  }
  for (k = 1; k <= n; k *= 2) {
    sort(sa, sa + n + 1, compare_sa);
    tmp[sa[0]] = 0;
    for (int i = 1; i <= n; i++) {
      tmp[sa[i]] = tmp[sa[i - 1]] + (compare_sa(sa[i - 1], sa[i]) ? 1 : 0);
    }
    for (int i = 0; i <= n; i++) {
      _rank[i] = tmp[i];
    }
  }
}
bool contain(string s, int *sa, string t) {
  int l = 0, r = s.size();
  while (r - l > 1) {
    int mid = (l + r) / 2;
    if (s.compare(sa[mid], t.size(), t) < 0)
      l = mid;
    else
      r = mid;
  }
  return s.compare(sa[r], t.size(), t) == 0;
}
int main() {
  string s, t;
  cin >> s >> t;
  vector<int> a(s.size());
  for (int i = 0; i < (int)(s.size()); i++) {
    cin >> a[i];
    a[i]--;
  }
  int l = -1, r = s.size() + 5;
  while (r - l > 1) {
    int med = (l + r) / 2;
    memset(used, 0, sizeof(used));
    for (int i = 0; i < (int)(med); i++) {
      used[a[i]] = true;
    }
    string ss = "";
    for (int i = 0; i < (int)(s.size()); i++) {
      if (used[i])
        continue;
      else
        ss += s[i];
    }
    bool flag = true;
    int tid = 0;
    for (int i = 0; i < (int)(ss.size()); i++) {
      if (ss[i] == t[tid]) {
        tid++;
      }
    }
    if (tid == t.size())
      l = med;
    else
      r = med;
  }
  cout << r - 1 << endl;
  return 0;
}
