#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
const int N3 = 1e3 + 10;
const int INF = 2e9 + 10;
const int mod = 1e9 + 7;
const long long LINF = 4e18 + 10;
int n, a[N * 2];
string s, t;
bool u[2 * N];
bool check(int x) {
  int pos = 0;
  for (int i = 0; i < n && pos < t.size(); ++i) {
    if (s[i] == t[pos] && !u[i]) {
      pos++;
    }
  }
  return (pos == t.size());
}
int main() {
  if ("" != "") {
    freopen(
        ""
        ".in",
        "r", stdin);
    freopen(
        ""
        ".out",
        "w", stdout);
  }
  cin >> s;
  cin >> t;
  n = s.size();
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    a[i]--;
  }
  int l = 0, r = n + 1;
  while (l < r) {
    int m = (l + r) / 2 + 1;
    for (int i = 0; i < n; ++i) {
      u[i] = 0;
    }
    for (int i = 1; i <= m; ++i) {
      u[a[i]] = 1;
    }
    if (!check(m)) {
      r = m - 1;
    } else {
      l = m;
    }
  }
  cout << l;
  return 0;
}
