#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, m, d[N], a[N];
bool flag[N];
bool check(int x) {
  memset(flag, 0, sizeof(flag));
  int cur = x - 1;
  for (int i = x; i >= 1; i--) {
    cur = min(cur, i - 1);
    if (d[i] && !flag[d[i]] && a[d[i]] <= cur) {
      flag[d[i]] = 1;
      cur -= a[d[i]] + 1;
    }
  }
  for (int i = 1; i <= m; i++) {
    if (!flag[i]) return 0;
  }
  return 1;
}
int main() {
  int ans = -1;
  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);
  int l = 1, r = n, mid;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (check(mid))
      r = mid - 1, ans = mid;
    else
      l = mid + 1;
  }
  printf("%d\n", ans);
}
