#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, 0, -1, 0, -1, -1, 1, 1};
int dy[] = {0, 1, 0, -1, -1, 1, -1, 1};
void fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
}
const long long mxN = 5e5 + 5, oo = 0x3f3f3f3f, mod = 1e9 + 7;
int n, k;
int a[mxN], req[mxN];
bool check(int x) {
  int last[mxN];
  memset(last, -1, sizeof last);
  for (int i = 0; i < x; i++) {
    last[a[i]] = i;
  }
  int cnt = 0, tot = 0;
  for (int i = 0; i < x; i++) {
    if (!a[i] || (last[a[i]] != i))
      cnt++;
    else {
      if (cnt >= req[a[i] - 1]) tot++, cnt -= req[a[i] - 1];
    }
  }
  return tot == k;
}
void solve() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < k; i++) cin >> req[i];
  int l = 0, r = n, res = -1;
  while (l <= r) {
    int mid = (l + r) / 2;
    if (check(mid)) {
      r = mid - 1;
      res = mid;
    } else
      l = mid + 1;
  }
  cout << res << "\n";
}
int main() {
  fast();
  solve();
}
