#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, m, a[N], b[N];
int sum = 0;
bool check(int x) {
  bool vis[N] = {0};
  int cur = x - m - sum;
  int cnt = 0;
  while (x) {
    if (cur < 0) return false;
    if (a[x] != 0 && !vis[a[x]]) {
      cnt++;
      vis[a[x]] = true;
      cur += b[a[x]];
    } else
      cur--;
    x--;
  }
  return (cur >= 0 && cnt == m);
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  for (int i = 1; i <= m; i++) {
    scanf("%d", b + i);
    sum += b[i];
  }
  int lo = sum, hi = n;
  int res = -1;
  while (lo <= hi) {
    int mid = (lo + hi) >> 1;
    if (check(mid)) {
      res = mid;
      hi = mid - 1;
    } else
      lo = mid + 1;
  }
  cout << res << endl;
}
