#include <bits/stdc++.h>
using namespace std;
int a[100005];
int b[100005];
int last[100005];
int done[100005];
int n, m;
int solve(int days) {
  for (int i = 1; i <= m; i++) {
    last[i] = -1;
  }
  for (int i = 1; i <= days; i++) {
    last[a[i]] = max(last[a[i]], i);
    done[i] = 0;
  }
  for (int i = 1; i <= m; i++) {
    if (last[i] == -1) {
      return 0;
    }
  }
  int ptr = 1;
  for (int i = 1; i <= days; i++) {
    if (a[i] && (i == last[a[i]])) {
      int req = b[a[i]];
      while ((ptr < i) && req) {
        if (done[ptr]) {
          ptr++;
        } else {
          done[ptr] = 1;
          req--;
          ptr++;
        }
      }
      if (req) {
        return 0;
      }
      done[i] = 1;
    }
  }
  return 1;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= m; i++) {
    cin >> b[i];
  }
  if (!solve(n)) {
    cout << -1 << endl;
    return 0;
  } else {
    int l = 1, r = n;
    while (l < r) {
      int mid = (l + r) >> 1;
      if (solve(mid)) {
        r = mid;
      } else {
        l = mid + 1;
      }
    }
    cout << l << endl;
    return 0;
  }
}
