#include <bits/stdc++.h>
using namespace std;
long long a[666666], b[666666];
long long sum[666666];
long long n, m, ss;
map<long long, long long> vis;
long long check(long long num) {
  long long res = num - m;
  if (res < ss) {
    return 0;
  }
  map<long long, long long> mp;
  long long cnt = 0;
  for (long long i = num; i >= 1; i--) {
    if (!mp[a[i]] && a[i]) {
      if (b[a[i]] >= i) return 0;
      if (res - b[a[i]] >= 0) {
        res -= b[a[i]];
        cnt++;
      } else {
        return 0;
      }
    }
    mp[a[i]] = 1;
  }
  if (res >= 0 && cnt >= m)
    return 1;
  else
    return 0;
}
signed main() {
  cin >> n >> m;
  long long add = 0;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long i = 1; i <= m; i++) {
    cin >> b[i];
    ss += b[i];
  }
  for (long long i = 1; i <= n; i++) {
    if (!vis[a[i]] && a[i]) {
      add++;
    }
    vis[a[i]] = 1;
    sum[i] = add;
  }
  if (add < m) {
    cout << "-1";
    return 0;
  }
  if (ss + m > n) {
    cout << "-1";
    return 0;
  }
  long long l = 1;
  long long r = n;
  long long ans = 99999999999999;
  while (l <= r) {
    long long mid = (l + r) / 2;
    if (check(mid)) {
      ans = mid;
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  if (ans == 99999999999999)
    cout << "-1";
  else
    cout << ans;
  return 0;
}
