#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<long long> vm(110000);
vector<long long> vn(110000);
int s[110000];
int isok(int mid) {
  memset(s, 0, sizeof(s));
  int sum = 0;
  for (int i = mid; i >= 0; i--) {
    if (sum != 0 && (vn[i] == 0 || s[vn[i]] == 1))
      sum--;
    else if (s[vn[i]] == 0 && vn[i] != 0) {
      s[vn[i]] = 1;
      sum += vm[vn[i] - 1];
    }
  }
  for (int i = m; i >= 1; i--) {
    if (s[i] == 0) return 0;
  }
  if (sum != 0) return 0;
  return 1;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> vn[i];
  for (int i = 0; i < m; i++) cin >> vm[i];
  int l = 0, r = n - 1;
  while (l < r) {
    int mid = (l + r) / 2;
    if (isok(mid))
      r = mid;
    else
      l = mid + 1;
  }
  if (r == n - 1 && !isok(n - 1))
    cout << -1 << endl;
  else
    cout << r + 1 << endl;
}
