#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> day(100005), timereq(100005);
int predfunc(int x) {
  queue<int> q;
  int cnt = 0;
  vector<pair<int, int> > ind;
  vector<int> vis(m + 1), cant(n + 1);
  for (int i = x; i >= 1; i--) {
    if (!vis[day[i]] && day[i]) {
      cant[i] = 1;
      ind.push_back({day[i], i});
      vis[day[i]] = 1;
    }
  }
  if (ind.size() != m) return 0;
  int start = ind[0].second, curexam = ind[0].first, curindex = 0;
  int currtimereq = timereq[curexam];
  for (int i = start; i >= 1; i--) {
    if (!cant[i]) {
      currtimereq--;
      if (currtimereq == 0) {
        curindex++;
        cnt++;
        if (curindex == m) break;
        i = min(i, ind[curindex].second);
        curexam = ind[curindex].first;
        currtimereq = timereq[curexam];
      }
    }
  }
  if (cnt != m) return 0;
  return 1;
}
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 >> day[i];
  for (int i = 1; i <= m; i++) cin >> timereq[i];
  int lo = 1, hi = n;
  while (lo < hi) {
    int mid = lo + (hi - lo) / 2;
    if (predfunc(mid))
      hi = mid;
    else
      lo = mid + 1;
  }
  if (!predfunc(n)) {
    cout << -1;
    return 0;
  }
  cout << lo;
  return 0;
}
