#include <bits/stdc++.h>
using namespace std;
vector<int> pos[100010];
int d[100010];
int a[100010];
int n, m;
bool judge(int mid) {
  vector<pair<int, int>> course;
  for (int i = 1; i <= m; i++) {
    vector<int>::iterator it = upper_bound(pos[i].begin(), pos[i].end(), mid);
    if (it == pos[i].begin()) return false;
    it--;
    course.push_back({*it, i});
  }
  sort(course.begin(), course.end());
  int used = 0;
  for (auto &c : course) {
    if (c.first - 1 - used < a[c.second]) return false;
    used += a[c.second] + 1;
  }
  return true;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", d + i);
    if (d[i] > 0) pos[d[i]].push_back(i);
  }
  for (int i = 1; i <= m; i++) scanf("%d", a + i);
  int l = 1, r = n;
  if (!judge(n))
    puts("-1");
  else {
    while (l < r) {
      int mid = l + r >> 1;
      if (judge(mid))
        r = mid;
      else
        l = mid + 1;
    }
    printf("%d", l);
  }
  return 0;
}
