#include <bits/stdc++.h>
using namespace std;
using LL = long long;
void Print() { cout << endl; }
template <typename T1, typename... T>
void Print(const T1 &t1, const T &...t) {
  cout << t1 << " ";
  Print(t...);
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
template <class Iterator>
ostream &output_cantainer(ostream &os, Iterator first, Iterator last,
                          bool space = true) {
  if (space) {
    for (Iterator it = first; it != last; it++) {
      os << (*it) << ' ';
    }
    os << endl;
  } else
    for (Iterator it = first; it != last; it++) {
      os << (*it) << endl;
    }
  return os;
}
const int N = 200005, B = 27;
int n, m, ord[N];
char t[N], s[N], q[N];
bool check(int p) {
  memcpy(q, t, sizeof(t));
  for (int i = 1; i <= p; i++) {
    q[ord[i] - 1] = '!';
  }
  for (int i = 0, j = 0; j < m; j++) {
    for (; i < n && s[j] != q[i]; i++) {
    }
    if (i == n) return false;
    i++;
  }
  return true;
}
int main() {
  scanf("%s%s", t, s);
  n = strlen(t);
  m = strlen(s);
  for (int i = 1; i <= n; i++) {
    scanf("%d", ord + i);
  }
  int l = 1, r = n;
  while (l <= r) {
    int mid = l + (r - l) / 2;
    if (check(mid)) {
      l = mid + 1;
    } else
      r = mid - 1;
  }
  printf("%d\n", r);
}
