#include <bits/stdc++.h>
using namespace std;
int vis[100010];
int a[100010], d[100010];
int c[100010];
int n, m;
bool check(int mid) {
  for (int i = 1; i <= mid; i++) c[i] = d[i];
  memset(vis, 0, sizeof vis);
  for (int i = mid; i >= 1; i--) {
    if (c[i]) {
      if (!vis[c[i]])
        vis[c[i]] = 1;
      else
        c[i] = 0;
    }
  }
  for (int i = 1; i <= m; i++) {
    if (!vis[i]) return false;
  }
  int cnt = 0;
  for (int i = 1; i <= mid; i++) {
    if (c[i] == 0) {
      cnt++;
    } else {
      if (cnt >= a[c[i]])
        cnt -= a[c[i]];
      else
        return false;
    }
  }
  return true;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> d[i];
  for (int i = 1; i <= m; i++) cin >> a[i];
  int l = 1, r = n;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (check(mid))
      r = mid - 1;
    else
      l = mid + 1;
  }
  if (check(l)) {
    cout << l << endl;
  } else {
    cout << -1 << endl;
  }
  return 0;
}
