#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int cla[maxn], ned[maxn];
bool vis[maxn];
int n, m;
bool work(int st) {
  memset(vis, 0, sizeof vis);
  int sum = 0;
  int nedday = 0;
  for (int j = st; j > 0; --j) {
    if (cla[j] > 0 && vis[cla[j]] == 0) {
      vis[cla[j]] = 1;
      nedday += ned[cla[j]];
      ++sum;
    } else {
      if (nedday) --nedday;
    }
  }
  if (sum == m && nedday == 0)
    return 1;
  else
    return 0;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ;
  cin >> n >> m;
  for (int j = 1; j <= n; ++j) {
    cin >> cla[j];
  }
  for (int j = 1; j <= m; ++j) {
    cin >> ned[j];
  }
  if (!work(n))
    cout << "-1" << endl;
  else {
    int l = 1, r = n;
    while (l + 1 < r) {
      int mid = (l + r) / 2;
      if (work(mid))
        r = mid;
      else
        l = mid;
    }
    cout << r << endl;
  }
  return 0;
}
