#include <bits/stdc++.h>
using namespace std;
int n, m, d[100002], a[100002];
bool visit[100002];
bool check(int val) {
  bool inside = false;
  memset(visit, false, sizeof visit);
  int ans = 0;
  for (int i = val; i > 0; i--) {
    if (d[i] && !visit[d[i]]) {
      visit[d[i]] = true;
      ans += a[d[i]];
      inside = true;
    } else if (inside) {
      ans--;
    }
    if (ans < 0) ans = 0;
  }
  if (ans > 0) return false;
  for (int i = 1; i <= m; i++)
    if (!visit[i]) return false;
  return true;
}
int binary_s() {
  int ans = -1;
  int low = 1, mid, high = n;
  while (low <= high) {
    mid = (low + high) / 2;
    if (check(mid)) {
      ans = mid;
      high = mid - 1;
    } else
      low = mid + 1;
  }
  return ans;
}
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]);
  printf("%d", binary_s());
  return 0;
}
