#include <bits/stdc++.h>
using namespace std;
template <class _E>
inline void read(_E &e) {
  e = 0;
  bool ck = 0;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') ck = 1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    e = e * 10 + ch - '0';
    ch = getchar();
  }
  if (ck) e = -e;
}
int n, m, ans = -1;
int d[100005], a[100005];
int L, R, mid;
inline bool check() {
  int i;
  int tmp = mid - 1;
  int vis[100005];
  memset(vis, 0, sizeof vis);
  for (i = mid; i; --i) {
    tmp = min(tmp, i - 1);
    if (d[i] && !vis[d[i]] && tmp >= a[d[i]]) {
      vis[d[i]] = 1;
      tmp = tmp - a[d[i]] - 1;
    }
  }
  for (int i = 1; i <= m; ++i)
    if (!vis[i]) return false;
  return true;
}
int main() {
  read(n), read(m);
  for (int i = 1; i <= n; ++i) read(d[i]);
  for (int i = 1; i <= m; ++i) read(a[i]);
  L = 1, R = n;
  while (L <= R) {
    mid = (L + R) >> 1;
    if (check())
      ans = mid, R = mid - 1;
    else
      L = mid + 1;
  }
  cout << ans;
  return 0;
}
