#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, c, i, j, k, ar[100005], br[100005], n, m, s;
  scanf("%lld%lld", &n, &m);
  for (i = 1; i <= n; i++) {
    scanf("%lld", &ar[i]);
  }
  long long sum = 0;
  for (i = 1; i <= m; i++) {
    scanf("%lld", &br[i]);
    sum += br[i];
  }
  c = 0;
  map<long long, long long> ma;
  s = 0;
  for (i = 1; i <= n; i++) {
    if (ma[ar[i]] == 0 && ar[i] != 0 && br[ar[i]] <= c) {
      s++;
    } else
      c++;
    if (s >= m && i >= sum + m) break;
  }
  if (i <= n)
    printf("%lld\n", i);
  else
    printf("-1\n");
}
