#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> day(n), prep(m);
  for (int i = 0; i < n; i++) cin >> day[i];
  for (int i = 0; i < m; i++) cin >> prep[i];
  int lo = 2;
  int hi = n;
  int result = -1;
  while (lo <= hi) {
    int mid = lo + (hi - lo) / 2;
    bool valid = true;
    set<int> S;
    vector<int> temp(mid);
    for (int i = mid - 1; i >= 0; i--) {
      if (day[i] != 0 and !S.count(day[i])) {
        S.insert(day[i]);
        temp[i] = day[i];
      }
    }
    if (S.size() < m) valid = false;
    int free = 0;
    for (int x : temp) {
      if (x == 0)
        free++;
      else {
        free -= prep[x - 1];
        if (free < 0) valid = false;
      }
    }
    if (valid) {
      result = mid;
      hi = mid - 1;
    } else
      lo = mid + 1;
  }
  printf("%d\n", result);
}
