#include <bits/stdc++.h>
const long long inf = 4611686018427387903;
const long long N = 100001;
using namespace std;
int p[N], b[N], a[N], n, m, l, r, c;
bool ff(int c) {
  for (int i = 1; i < m + 1; i++) p[i] = 0;
  int k = 0, kol = 0;
  for (int i = c - 1; i != 0; i--)
    if (p[a[i]] == 0 && a[i] != 0) p[a[i]] = i;
  for (int i = 0; i < c; i++) {
    if (p[a[i]] == i && a[i] != 0) {
      if (k >= b[a[i] - 1]) {
        k -= b[a[i] - 1];
        kol++;
      } else
        return false;
    } else
      k++;
  }
  if (kol == m)
    return true;
  else
    return false;
}
int main() {
  cin >> n >> m;
  if (n == 1) {
    cout << -1;
    return 0;
  }
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) cin >> b[i];
  l = 1;
  r = n - 1;
  while (l < r) {
    c = (l + r) / 2;
    if (ff(c))
      r = c;
    else
      l = c + 1;
  }
  if (ff(l - 1)) l--;
  if (!ff(l)) l++;
  if (!ff(l)) {
    cout << -1;
    return 0;
  }
  if (l > n) {
    cout << -1;
    return 0;
  }
  cout << l << "\n";
}
