#include <bits/stdc++.h>
const int _ = 101000, INF = 2147483647;
int n, m, a[_], day[_], tot[_];
bool beaten[_];
inline int read() {
  int s = 1, w = 0;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') s = -1;
  for (; isdigit(ch); ch = getchar()) w = w * 10 + ch - '0';
  return s * w;
}
bool check(int x) {
  memset(beaten, false, sizeof beaten), memset(tot, false, sizeof tot);
  long long cost = 0;
  int rest = 0;
  for (int i = 1; i <= x; i++) tot[day[i]]++;
  for (int i = 1; i <= x; i++) {
    if (day[i] != 0 && !beaten[day[i]] && tot[day[i]] == 1) {
      rest -= a[day[i]];
      if (rest < 0) return true;
      beaten[day[i]] = true;
    } else {
      rest++;
      if (tot[day[i]] > 1 && !beaten[day[i]]) tot[day[i]]--;
    }
  }
  for (int i = 1; i <= m; i++)
    if (!beaten[i]) return true;
  return false;
}
int main() {
  n = read(), m = read();
  for (int i = 1; i <= n; i++) day[i] = read();
  for (int i = 1; i <= m; i++) a[i] = read();
  int l = 1, r = n, mid, ans = INF;
  while (l <= r) {
    mid = l + r >> 1;
    if (!check(mid))
      r = mid - 1, ans = mid;
    else
      l = mid + 1;
  }
  printf("%d", ans == INF ? -1 : ans);
  return 0;
}
