#include <bits/stdc++.h>
using namespace std;
long long int mul(long long int x, long long int y) {
  long long int ans = 1;
  while (y > 0) {
    if (y & 1) ans = (ans * x) % 1000000007;
    x = (x * x) % 1000000007;
    y /= 2;
  }
  return ans;
};
long long int a[100005], d[100005];
int main() {
  long long int n, m, i, ans = -1, lim = 0, flag, sb, day, last;
  cin >> n >> m;
  vector<set<long long int> > v(m + 1);
  set<pair<long long int, long long int> > s;
  set<long long int> tmp;
  set<pair<long long int, long long int> >::iterator it;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    v[a[i]].insert(i);
  }
  for (i = 1; i <= m; i++)
    if (v[i].size() > 0) v[i].erase(*(v[i].rbegin()));
  for (i = 1; i <= m; i++) {
    cin >> d[i];
    lim += d[i];
  }
  lim += m;
  for (i = n; i > 0; i--)
    if (a[i] != 0 && tmp.find(a[i]) == tmp.end()) {
      tmp.insert(a[i]);
      s.insert(make_pair(i, a[i]));
    }
  if (s.size() < m) {
    cout << -1;
    return 0;
  }
  last = 0;
  for (it = s.begin(); it != s.end(); it++) {
    sb = (*it).second;
    day = (*it).first;
    if (last + d[sb] >= day) {
      cout << -1;
      return 0;
    }
    last += (d[sb] + 1);
  }
  ans = (*s.rbegin()).first;
  while ((*s.rbegin()).first > lim) {
    sb = (*s.rbegin()).second;
    if (v[sb].size() > 0) {
      s.erase(*(s.rbegin()));
      flag = 0;
      day = *v[sb].rbegin();
      v[sb].erase(day);
      s.insert(make_pair(day, sb));
      last = 0;
      for (it = s.begin(); it != s.end(); it++) {
        sb = (*it).second;
        day = (*it).first;
        if (last + d[sb] >= day) {
          flag = 1;
          break;
        }
        last += (d[sb] + 1);
      }
      if (flag == 0)
        ans = (*s.rbegin()).first;
      else
        break;
    } else
      break;
  }
  cout << ans;
  return 0;
}
