#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 100;
pair<int, int> w[N];
bool mark[N];
int a[N];
bool check(int r, int m) {
  fill(mark + 1, mark + m + 1, 0);
  for (int i = r; i > 0; i--) {
    if (!mark[a[i]] && a[i] > 0) {
      mark[a[i]] = 1;
      w[a[i]].first = i;
    }
  }
  sort(w + 1, w + m + 1);
  if (w[m].first > r) {
    return 0;
  }
  int last = 0;
  int day = 0;
  for (int i = 1; i <= m; i++) {
    day += w[i].first - 1 - last;
    day -= w[i].second;
    if (day < 0) return 0;
    last = w[i].first;
  }
  return 1;
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= m; i++) {
    int t;
    cin >> t;
    w[i].second = t;
  }
  if (!check(n, m)) {
    cout << -1;
    return 0;
  }
  int l = -1, r = n;
  while (r - l > 1) {
    int mid = (l + r) / 2;
    if (check(mid, m))
      r = mid;
    else
      l = mid;
  }
  cout << r;
}
