#include <bits/stdc++.h>
using namespace std;
const int E = 1e5 + 9;
int a[E];
int b[E];
int last[E];
int arr[E];
int n, m;
bool cmp(int x, int y) { return last[x] < last[y]; }
bool check(int k) {
  fill(last, last + m + 1, 0);
  for (int i = 1; i <= k; i++) {
    if (a[i] == 0) {
      continue;
    }
    last[a[i]] = i;
  }
  for (int i = 1; i <= m; i++) {
    if (last[i] == 0) {
      return false;
    }
  }
  iota(arr, arr + m + 1, 0);
  sort(arr + 1, arr + m + 1, cmp);
  int d = 0;
  for (int i = 1; i <= m; i++) {
    d += b[arr[i]];
    if (d > last[arr[i]] - i) {
      return false;
    }
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= m; i++) {
    cin >> b[i];
  }
  int l = 0, r = n + 9;
  while (r - l > 1) {
    int mid = (r + l) / 2;
    if (check(mid)) {
      r = mid;
    } else {
      l = mid;
    }
  }
  if (r > n) {
    cout << -1;
    return 0;
  }
  cout << r;
  return 0;
}
