#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int m, n;
bool v[N];
int a[N], d[N];
vector<int> V;
bool f(int k) {
  for (int i = 1; i <= m; i++) v[i] = false;
  V.clear();
  for (int i = k; i >= 0; i--)
    if (a[i] > 0 && !v[a[i]]) {
      V.push_back(i);
      v[a[i]] = true;
    }
  if (V.size() < m) return false;
  int sum = 0;
  for (int i = m - 1; i >= 0; i--) {
    sum += d[a[V[i]]];
    if (sum > V[i] + i - m + 1) return false;
  }
  return true;
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  for (int i = 0; i < m; i++) scanf("%d", d + i + 1);
  if (!f(n - 1)) {
    printf("-1\n");
    return 0;
  }
  int l = 0;
  int r = n - 1;
  while (l < r) {
    int mid = (l + r) / 2;
    if (f(mid))
      r = mid;
    else
      l = mid + 1;
  }
  printf("%d\n", r + 1);
  return 0;
}
