#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &_) {
  _ = 0;
  char __ = getchar();
  bool ___ = false;
  while (__ < '0' || __ > '9') {
    if (__ == '-') ___ = true;
    __ = getchar();
  }
  while (__ >= '0' && __ <= '9') {
    _ = (_ << 3) + (_ << 1) + __ - '0';
    __ = getchar();
  }
  if (___) _ = -_;
}
const int maxn = 1e5 + 5;
int d[maxn];
int a[maxn];
bool vis[maxn];
inline bool judge(int limit, int m) {
  memset(vis, 0, sizeof vis);
  int sum = 0;
  for (int i = limit; i >= 1; i--) {
    if (!d[i]) {
      if (sum) sum--;
      continue;
    }
    if (vis[d[i]]) {
      if (sum) sum--;
      continue;
    }
    vis[d[i]] = 1;
    sum += a[d[i]];
  }
  for (int i = 1; i <= m; i++)
    if (!vis[i]) return false;
  if (sum) return false;
  return true;
}
int main() {
  int n, m;
  read(n), read(m);
  for (int i = 1; i <= n; i++) read(d[i]);
  for (int i = 1; i <= m; i++) read(a[i]);
  int l = 0, r = n, mid;
  int ans = 0x3f3f3f3f;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (judge(mid, m))
      r = mid - 1, ans = mid;
    else
      l = mid + 1;
  }
  if (ans < 0x3f3f3f3f)
    printf("%d", ans);
  else
    printf("-1");
  return 0;
}
