#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 1;
int n, m, d[N], l, r, a[N], v[N], s, id[N];
bool cp(int i, int j) { return v[i] < v[j]; }
bool slv(int n) {
  s = 0;
  memset(v, -1, sizeof v);
  for (int i = 1; i <= m; ++i) id[i] = i;
  for (int i = 1; i <= n; ++i) v[d[i]] = i;
  sort(id + 1, id + m + 1, cp);
  for (int j = 1; j <= m; ++j) {
    int i = id[j];
    if (s + a[i] >= v[i]) return false;
    s += a[i] + 1;
  }
  return true;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", d + i);
  for (int i = 1; i <= m; ++i) scanf("%d", a + i);
  l = 0, r = n;
  while (l < r) {
    int m = (l + r) / 2;
    if (slv(m))
      r = m;
    else
      l = m + 1;
  }
  printf("%d\n", slv(l) ? l : -1);
  return 0;
}
