#include <bits/stdc++.h>
using namespace std;
const signed int MAX = 1e5 + 5;
signed int N;
signed int M;
signed int num[MAX];
signed int cost[MAX];
signed int last[MAX];
bool check(signed int idx) {
  for (signed int i = (1); i <= (M); ++i) last[i] = 0;
  for (signed int i = (1); i <= (idx); ++i) last[num[i]] = i;
  signed long long free = 0;
  signed long long c = 0;
  signed int n = 0;
  for (signed int i = (1); i <= (idx); ++i) {
    if (num[i] == 0 || last[num[i]] > i)
      free++;
    else {
      c += cost[num[i]];
      if (c > free) return 0;
      n++;
    }
  }
  return n == M;
}
signed int main() {
  scanf("%d %d", &N, &M);
  for (signed int i = 0; i < (N); ++i) scanf("%d", num + i + 1);
  for (signed int i = 0; i < (M); ++i) scanf("%d", cost + i + 1);
  signed int low = 0, high = N + 1;
  signed int mid;
  while (low < high) {
    mid = low + high >> 1;
    if (check(mid))
      high = mid;
    else
      low = mid + 1;
  }
  if (low == N + 1 || low == 0) low = -1;
  printf("%d\n", low);
  return 0;
}
