#include <bits/stdc++.h>
using namespace std;
long long int d[100001], a[100001];
vector<long long int> v[100001];
long long int temp[100001];
vector<long long int>::iterator it;
long long int fun(long long int cur, long long int n) {
  if (v[cur].size() == 0) return -1;
  it = upper_bound(v[cur].begin(), v[cur].end(), n);
  if (it == v[cur].begin()) return -1;
  it--;
  if (*it > n)
    return -1;
  else
    return *it;
}
int main() {
  long long int n, m;
  cin >> n >> m;
  for (long long int i = 1; i <= n; ++i) {
    cin >> d[i];
    if (d[i] != 0) v[d[i]].push_back(i);
  }
  for (long long int i = 1; i <= m; ++i) {
    cin >> a[i];
  }
  long long int low = 1;
  long long int high = n;
  long long int last = -1;
  long long int ans = 1e15;
  while (low <= high) {
    long long int mid = low + (high - low) / 2;
    memset(temp, 0, sizeof(temp));
    for (long long int i = 1; i <= m; ++i) {
      last = fun(i, mid);
      if (last == -1)
        break;
      else
        temp[last] = i;
    }
    if (last == -1) {
      low = mid + 1;
    } else {
      long long int prep = 0;
      long long int req = 0;
      long long int flag = 1;
      for (long long int i = 1; i <= mid; ++i) {
        if (temp[i] == 0)
          prep++;
        else {
          req += a[temp[i]];
          if (prep < req) {
            flag = 0;
            break;
          }
        }
      }
      if (flag == 0) {
        low = mid + 1;
      } else {
        high = mid - 1;
        ans = min(ans, mid);
      }
    }
  }
  if (ans == 1e15)
    cout << -1 << endl;
  else
    cout << ans << endl;
  return 0;
}
