#include <bits/stdc++.h>
using namespace std;
int n, m;
int d[100005];
int a[100005];
bool used[100005];
bool C(int x) {
  used[0] = true;
  for (int i = 1; i <= m; ++i) {
    used[i] = false;
  }
  int passed = 0;
  int day = 0;
  for (int i = x - 1; i >= 0; --i) {
    if (!used[d[i]]) {
      passed++;
      day += a[d[i]];
      used[d[i]] = true;
    } else {
      if (day > 0) day--;
    }
  }
  if (passed == m && day == 0)
    return true;
  else
    return false;
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &d[i]);
  }
  for (int i = 1; i <= m; ++i) {
    scanf("%d", &a[i]);
  }
  int lb = 0, ub = n;
  while (ub - lb > 1) {
    int middle = (lb + ub) / 2;
    if (C(middle))
      ub = middle;
    else
      lb = middle;
  }
  if (ub == n && !C(n)) ub = -1;
  printf("%d\n", ub);
  return 0;
}
