#include <bits/stdc++.h>
using namespace std;
const int inf = (int)(1e9) + 100;
const int mod = (int)(1e9) + 100;
const int N = (int)(2e5) + 100;
int n, m, a[100100], d[100100];
bool ok(int len) {
  vector<pair<int, int> > v;
  vector<int> pos;
  pos.assign(m + 1, -1);
  for (int i = 0; i < len; i++) {
    pos[d[i]] = i;
  }
  for (int i = 1; i <= m; i++)
    if (pos[i] == -1) return false;
  for (int i = 1; i <= m; i++) v.push_back(make_pair(pos[i], i));
  sort(v.begin(), v.end());
  vector<int> b;
  b.push_back(0);
  for (int i = 0; i < m; i++) b.push_back(a[i]);
  vector<int> days;
  for (int i = 0; i < len; i++) {
    if (d[i] == 0)
      days.push_back(0);
    else if (pos[d[i]] == i)
      days.push_back(d[i]);
    else
      days.push_back(0);
  }
  int ii = 0;
  for (int i = 0; i < len; i++) {
    if (days[i] == 0) {
      while (ii < m && b[v[ii].second] == 0) ii++;
      if (ii >= m) continue;
      b[v[ii].second]--;
    } else {
      if (b[days[i]] > 0) return false;
    }
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> d[i];
  for (int i = 0; i < m; i++) cin >> a[i];
  int l = 1, r = n, ans = -1;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (ok(mid)) {
      ans = mid;
      r = mid - 1;
    } else
      l = mid + 1;
  }
  printf("%d\n", ans);
  return 0;
}
