#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-8;
const int mod = 1e9 + 7;
const int N = 1e6 + 10;
const long long INF = 5e18;
long long power(long long x, long long y) {
  long long t = 1;
  while (y > 0) {
    if (y % 2)
      y -= 1, t = t * x % mod;
    else
      y /= 2, x = x * x % mod;
  }
  return t;
}
int n, m;
int u[N], arr[N];
int day[N];
vector<int> ak;
int solve(int n) {
  n++;
  for (int i = 0; i < m + 1; ++i) u[i] = 0;
  ak.clear();
  for (int i = n - 1; i >= 0; i--) {
    if (day[i] && u[day[i]] == 0) {
      u[day[i]] = 1;
      ak.push_back(arr[day[i]]);
    } else {
      if (ak.size()) {
        ak.back()--;
        if (ak.back() == 0) ak.pop_back();
      }
    }
  }
  for (int i = 1; i < m + 1; ++i)
    if (u[i] == 0) return 0;
  if (ak.size()) return 0;
  return 1;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) scanf("%d", &day[i]);
  for (int i = 0; i < m; ++i) scanf("%d", &arr[i + 1]);
  if (!solve(n - 1)) {
    printf("-1\n");
    exit(0);
  }
  int l = 0;
  int r = n - 1;
  while (l < r) {
    int m = (l + r) >> 1;
    if (solve(m))
      r = m;
    else
      l = m + 1;
  }
  printf("%d\n", l + 1);
  return 0;
}
