#include <bits/stdc++.h>
using namespace std;
const int M = (int)1e9 + 7;
const int N = 1e5 + 5;
int n, m;
int a[N], d[N];
bool pos(int k) {
  vector<pair<int, int> > dead(m);
  int i;
  for (i = 0; i < m; i++) dead[i].second = i;
  for (i = 0; i <= k - 1; i++)
    if (d[i] != 0) {
      dead[d[i] - 1].first = i;
    }
  sort(dead.begin(), dead.end());
  int cur = 0;
  for (i = 0; i < m; i++) {
    dead[i].first -= i;
  }
  for (i = 0; i < m; i++) {
    cur += a[dead[i].second];
    if (cur > dead[i].first) return false;
  }
  return true;
}
int main() {
  cout.precision(15);
  cout.setf(ios::fixed);
  int i;
  cin >> n >> m;
  for (i = 0; i < n; i++) cin >> d[i];
  for (i = 0; i < m; i++) cin >> a[i];
  int l = 0, h = n;
  int mid;
  while (l < h) {
    mid = (l + h) >> 1;
    if (pos(mid))
      h = mid;
    else
      l = mid + 1;
  }
  if (pos(l))
    cout << l << '\n';
  else
    cout << -1 << '\n';
}
