#include <bits/stdc++.h>
using namespace std;
int day[100005];
int cnt[100005];
int vis[100005];
int n, m;
int jud(int x) {
  memset(vis, 0, sizeof(vis));
  int i, j;
  int sum = 0, cntt = 0;
  ;
  for (i = x; i >= 1; i--) {
    if (day[i] && vis[day[i]] == 0) {
      cntt++;
      vis[day[i]] = 1;
      sum += cnt[day[i]];
    } else if (sum)
      sum--;
  }
  if (cntt == m && sum == 0)
    return 1;
  else
    return 0;
}
int main() {
  int i, j;
  scanf("%d %d", &n, &m);
  for (i = 1; i <= n; i++) scanf("%d", &day[i]);
  for (i = 1; i <= m; i++) scanf("%d", &cnt[i]);
  int left, right, mid;
  int ans = -1;
  left = 1, right = n;
  while (left <= right) {
    mid = (left + right) >> 1;
    if (jud(mid)) {
      right = mid - 1;
      ans = mid;
    } else {
      left = mid + 1;
    }
  }
  printf("%d\n", ans);
  return 0;
}
