#include <bits/stdc++.h>
using namespace std;
int a[100005], c[100005], d[100005];
int n, m;
struct node {
  int fuxi;
  int num;
};
stack<node> st;
bool flag = false;
bool can(int x) {
  memset(c, 0, sizeof(c));
  int sum = m;
  while (!st.empty()) st.pop();
  while (a[x] == 0 && x >= 1) {
    x--;
  }
  if (x < 1) return false;
  if (x == 1) {
    if (m == 1 && d[1] == 0) {
      flag = true;
      return true;
    } else
      return false;
  }
  node s;
  s.fuxi = d[a[x]];
  s.num = a[x];
  c[a[x]] = 1;
  st.push(s);
  for (int i = x - 1; i >= 1; i--) {
    if (a[i] == 0 || c[a[i]] == 1) {
      c[a[i]] = 1;
      if (!st.empty()) {
        node p;
        p = st.top();
        st.pop();
        p.fuxi--;
        if (p.fuxi == 0) {
          sum--;
        } else {
          st.push(p);
        }
      }
    } else {
      node p;
      p.fuxi = d[a[i]];
      p.num = a[i];
      st.push(p);
      c[a[i]] = 1;
    }
  }
  if (sum == 0) {
    flag = true;
    return true;
  } else
    return false;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d", &d[i]);
  }
  int L = 0, R = n + 1;
  while (L < R) {
    int mid = (L + R) / 2;
    if (can(mid)) {
      R = mid;
    } else
      L = mid + 1;
  }
  if (flag)
    cout << L << endl;
  else
    cout << "-1" << endl;
  return 0;
}
