#include <bits/stdc++.h>
using namespace std;
int d[100010];
int a[100010];
int vis[100010];
int n, m;
bool ok(int mid) {
  memset(vis, -1, sizeof(vis));
  int cnt = 0;
  for (int i = mid; i >= 1; --i) {
    if (d[i] && vis[d[i]] == -1) {
      vis[d[i]] = i;
      ++cnt;
    }
  }
  if (cnt != m) return false;
  int sum = 0;
  for (int i = 1; i <= mid; ++i) {
    if (!d[i] || vis[d[i]] != i)
      ++sum;
    else {
      sum -= a[d[i]];
      if (sum < 0) return false;
    }
  }
  return true;
}
int main() {
  scanf("%d", &n);
  ;
  scanf("%d", &m);
  ;
  for (int i = 1; i <= n; ++i) scanf("%d", &d[i]);
  ;
  scanf("%d", &a[1]);
  ;
  for (int i = 2; i <= m; ++i) scanf("%d", &a[i]);
  ;
  int l = 1, r = 1e5, mid;
  while (l < r) {
    mid = l + (r - l) / 2;
    if (ok(mid))
      r = mid;
    else
      l = mid + 1;
  }
  if (!ok(l))
    printf("-1\n");
  else
    printf("%d\n", l);
  ;
}
