#include <bits/stdc++.h>
using namespace std;
bool f1(pair<long long, long long> x, pair<long long, long long> y) {
  return x.first < y.first;
}
bool f2(pair<long long, long long> x, pair<long long, long long> y) {
  return x.first > y.first;
}
bool f3(long long x, long long y) { return x > y; }
long long gcd(long long x, long long y) {
  if (x == 0) return y;
  return gcd(y % x, x);
}
long long powmod(long long x, long long y, long long m) {
  if (y == 0) return 1;
  long long p = powmod(x, y / 2, m) % m;
  p = (p * p) % m;
  return (y % 2 == 0) ? p : (x * p) % m;
}
long long modif(long long x, long long m) { return (powmod(x, m - 2, m)); }
bool fa(vector<long long> x, vector<long long> y) { return x[0] < y[0]; }
bool fs(vector<long long> x, vector<long long> y) {
  return x.size() > y.size();
}
long long n, m;
vector<long long> v, d, c;
bool p(long long x) {
  vector<long long> b(m, -1ll);
  vector<long long> meow;
  long long da = 0;
  for (int i = x; i >= 0; i--) {
    long long y = d[i];
    if (!d[i]) continue;
    y--;
    if (b[y] == -1) {
      b[y] = i;
      meow.push_back(y);
    }
  }
  if (meow.size() != m) return 0;
  for (int i = m - 1; i >= 0; i--) {
    long long y = meow[i];
    if (b[y] - da < v[y]) return 0;
    da++;
    da += v[y];
  }
  return true;
}
long long haha(long long x, long long y) {
  while (x != y) {
    long long mid = x + (y - x) / 2;
    if (p(mid))
      y = mid;
    else
      x = mid + 1;
  }
  if (!p(x)) return -2;
  return x;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    d.push_back(x);
  }
  for (int i = 0; i < m; i++) {
    long long x;
    cin >> x;
    v.push_back(x);
  }
  long long ans = haha(0, n - 1);
  ans++;
  cout << ans;
  return 0;
}
