#include <bits/stdc++.h>
using namespace std;
int n, m;
int num[110000];
int pre[110000];
int vis[110000];
bool ok(int ends) {
  int cost = 0;
  int cnt = 0;
  memset(vis, 0, sizeof vis);
  vis[0] = 1;
  for (int i = ends; i >= 1; i--) {
    if (cnt == m) break;
    if (vis[num[i]]) {
      if (cost > 0) cost--;
    } else {
      cost += pre[num[i]];
      cnt++;
      vis[num[i]] = 1;
    }
    if (cost > i - 1) return false;
  }
  if (cnt != m) return false;
  return true;
}
int main() {
  while (~scanf("%d%d", &n, &m)) {
    for (int i = 1; i <= n; i++) scanf("%d", &num[i]);
    for (int j = 1; j <= m; j++) scanf("%d", &pre[j]);
    int l = 1, r = n;
    while (l < r) {
      int m = (l + r) / 2;
      if (ok(m))
        r = m;
      else
        l = m;
      if (l + 1 == r) {
        if (ok(l)) {
          r = l;
        }
        break;
      }
    }
    if (ok(r))
      printf("%d\n", r);
    else
      printf("-1\n");
  }
  return 0;
}
