#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e17 + 10;
const int N = 2e5 + 10;
const long long mod = 1e9 + 7;
const int base = 131;
const double pi = acos(-1);
map<string, int> ml;
map<int, int> vi;
long long b[N], c[N], num[N], a[N], n, m, k, x, y, z, vis[N];
long long ex, ey, cnt, ans, sum, flag, w;
long long nex[N], f[N], B, S, C;
vector<int> v[N];
map<string, int> mp;
map<string, int> can;
set<long long> second;
string s, t;
bool check(int x) {
  for (int i = 0; i <= n; i++) vis[i] = 0;
  for (int i = 1; i <= x; i++) vis[a[i] - 1] = 1;
  int p = 0;
  for (int i = 0; t[i]; i++) {
    flag = 0;
    for (int j = p; s[j]; j++) {
      if (vis[j]) continue;
      if (t[i] == s[j]) {
        flag = 1;
        p = j + 1;
        break;
      }
    }
    if (!flag) return 0;
  }
  return 1;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> s >> t;
  n = s.size();
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  int l = 1, r = n - 1;
  while (l <= r) {
    int mid = l + r >> 1;
    if (check(mid)) {
      ans = mid;
      l = mid + 1;
    } else
      r = mid - 1;
  }
  cout << ans;
}
