#include <bits/stdc++.h>
using namespace std;
int d[100005], a[100005], ld[100005];
int n, m;
int f(int x) {
  int i, ct = 0, fd = 0;
  for (i = 0; i <= m; i++) ld[i] = 0;
  for (i = 1; i <= x; i++) ld[d[i]] = i;
  for (i = 1; i <= x; i++) {
    int t = ld[d[i]];
    if (d[i] == 0)
      fd++;
    else if (ld[d[i]] != i)
      fd++;
    else if (ld[d[i]] == i && fd >= a[d[i]]) {
      fd -= a[d[i]];
      ct++;
    } else
      fd++;
  }
  if (ct == m) return 1;
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int i, l, r, mi;
  cin >> n >> m;
  for (i = 1; i <= n; i++) cin >> d[i];
  for (i = 1; i <= m; i++) cin >> a[i];
  l = 1;
  r = n;
  while (l < r) {
    mi = (l + r) / 2;
    if (f(mi))
      r = mi;
    else
      l = mi + 1;
  }
  if (f(l))
    cout << l << "\n";
  else
    cout << "-1\n";
  return 0;
}
