#include <bits/stdc++.h>
using namespace std;
int exams[1000000];
int prac[1000000];
int calc(int x, int m) {
  int use = 0;
  bool done[m + 2];
  memset(done, 0, sizeof done);
  for (int i = x; i >= 0; i--) {
    if (exams[i] != 0) {
      if (done[exams[i]] == false) {
        if (prac[exams[i] - 1] + use <= i) {
          m--;
          use += prac[exams[i] - 1];
          done[exams[i]] = true;
        } else
          use = max(0, use - 1);
      } else
        use = max(0, use - 1);
    } else
      use = max(0, use - 1);
  }
  if (m <= 0) return true;
  return false;
}
int main() {
  int n, m;
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> exams[i];
  for (int i = 0; i < m; i++) cin >> prac[i];
  int l = 0;
  int h = n - 1;
  int ans = -2;
  while (l <= h) {
    int mid = (l + h) / 2;
    if (calc(mid, m) == true) {
      ans = mid;
      h = mid - 1;
    } else
      l = mid + 1;
  }
  cout << ans + 1 << endl;
}
