#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int n, m;
struct data {
  int day, sub;
  data(int day = 0, int sub = 0) : day(day), sub(sub){};
  bool operator<(const data &rhs) const { return day < rhs.day; }
} s[maxn];
int d[maxn], a[maxn];
bool vis[maxn];
bool check(int cur) {
  memset(vis, false, sizeof vis);
  int lt = m;
  int cnt = 0;
  for (int i = cur; i > 0; i--)
    if (d[i] && !vis[d[i]]) {
      lt--;
      vis[d[i]] = true;
      s[cnt++] = data(i, d[i]);
      if (lt == 0) break;
    }
  if (lt) return false;
  sort(s, s + cnt);
  int c = s[0].day - 1;
  int need;
  for (int i = 0; i < cnt; i++) {
    need = a[s[i].sub];
    if (i) c += s[i].day - s[i - 1].day - 1;
    c -= need;
    if (c < 0) return false;
  }
  return true;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) scanf("%d", &d[i]);
  for (int i = 1; i <= m; i++) scanf("%d", &a[i]);
  int l = 0, r = n, mid;
  while (l + 1 < r) {
    mid = (l + r) >> 1;
    if (check(mid))
      r = mid;
    else
      l = mid;
  }
  if (r == n) {
    if (check(r))
      cout << n << endl;
    else
      cout << -1 << endl;
  } else
    cout << r << endl;
  return 0;
}
