#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 8;
long long a[N];
int n, m, d[N], Max[N];
bool avail(int g) {
  for (int i = 1; i <= g; i++) Max[d[i]] = i;
  int day = 0;
  int Count = 0;
  for (int i = 1; i <= g; i++) {
    if (d[i] == 0 or i != Max[d[i]])
      day++;
    else if (day >= a[d[i]]) {
      day -= a[d[i]];
      Count++;
    } else
      break;
  }
  return Count == m;
}
int calc(int l, int r) {
  int res = -1;
  while (l <= r) {
    int g = (l + r) >> 1;
    if (avail(g)) {
      res = g;
      r = g - 1;
    } else
      l = g + 1;
  }
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> d[i];
  for (int i = 1; i <= m; i++) cin >> a[i];
  cout << calc(1, n);
}
