#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
char str1[N], str2[N];
int len1, len2;
int vis[N], num[N];
bool judge(int pos) {
  memset(vis, 0, sizeof(vis));
  for (int i = 0; i < pos; i++) {
    vis[num[i] - 1] = 1;
  }
  int ans = 0;
  for (int i = 0; i < len1; i++) {
    if (vis[i] == 0 && (str2[ans] == str1[i])) ans++;
    if (ans >= len2) return true;
  }
  return false;
}
int main() {
  int ans;
  cin >> str1 >> str2;
  len1 = strlen(str1);
  len2 = strlen(str2);
  for (int i = 0; i < len1; i++) {
    cin >> num[i];
  }
  int mid;
  int l = 0, r = len1 - 1;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (judge(mid)) {
      l = mid + 1;
      ans = mid;
    } else {
      r = mid - 1;
    }
  }
  cout << ans << endl;
}
