#include <bits/stdc++.h>
using namespace std;
int A[100001];
int need[100001];
int n, m;
bool can(int x) {
  vector<int> deadline(m + 1, 0);
  for (int i = 1; i <= x; i++) deadline[A[i]] = max(deadline[A[i]], i);
  vector<pair<int, int>> study;
  for (int i = 1; i <= m; i++) study.push_back({deadline[i], i});
  sort(study.begin(), study.end());
  int d = 1;
  int have = 0;
  for (int i = 0; i < study.size(); i++) {
    have += study[i].first - d;
    d = study[i].first + 1;
    if (have < need[study[i].second]) return false;
    have -= need[study[i].second];
  }
  return true;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> A[i];
  for (int j = 1; j <= m; j++) cin >> need[j];
  if (!can(n)) return cout << -1, 0;
  int l = 1, r = n;
  while (l < r) {
    int mi = (l + r) / 2;
    if (can(mi))
      r = mi;
    else
      l = mi + 1;
  }
  cout << r;
}
