#include <bits/stdc++.h>
using namespace std;
char t[200010], p[200010];
int n, len, l, r, mid, ans;
int a[200010];
bool vis[200010];
bool check(int x) {
  int tot = 0;
  memset(vis, false, sizeof(vis));
  for (int i = x + 1; i <= n; ++i) vis[a[i]] = true;
  for (int i = 1; i <= n; ++i) {
    if (!vis[i]) continue;
    if (p[tot] == t[i - 1]) ++tot;
    if (tot + 1 > len) return true;
  }
  return false;
}
int main() {
  scanf("%s", &t);
  scanf("%s", &p);
  n = strlen(t), len = strlen(p);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  l = 1, r = n;
  while (l <= r) {
    mid = (l + r) / 2;
    if (check(mid)) {
      l = mid + 1;
      ans = mid;
    } else {
      r = mid - 1;
    }
  }
  cout << ans;
  return 0;
}
