#include <bits/stdc++.h>
using namespace std;
char _buf[33554432], *_s = _buf;
template <class T>
inline T rd() {
  if (_s == _buf + (33554432)) _s = _buf;
  if (_s == _buf) fread(_s, 1, 33554432, stdin);
  register T x = 0, f = 1;
  while (!isdigit(*_s)) {
    if (*_s == '-') f = -1;
    ++_s;
  }
  while (isdigit(*_s)) x = x * 10 + *_s++ - 48;
  return x * f;
}
template <class T>
inline void wt(T x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) wt(x / 10);
  putchar(x % 10 + 48);
}
int n = rd<int>(), m = rd<int>(), d[(100005)], a[(100005)], l = 1, r = n, mid;
bool f[(100005)];
inline bool judge(int x) {
  memset(f, 0, sizeof f), f[0] = 1;
  int sum = 0;
  for (; x; --x)
    if (d[x] && !f[d[x]])
      f[d[x]] = 1, sum += a[d[x]];
    else if (sum)
      --sum;
  if (sum) return 0;
  for (x = 1; x <= m; ++x)
    if (!f[x]) return 0;
  return 1;
}
int main() {
  register int i = 1;
  for (; i <= n; ++i) d[i] = rd<int>();
  for (i = 1; i <= m; ++i) a[i] = rd<int>();
  while (l < r) {
    mid = l + r >> 1;
    if (judge(mid))
      r = mid;
    else
      l = mid + 1;
  }
  if (judge(l))
    wt(l);
  else if (judge(r))
    wt(r);
  else
    wt(-1);
}
