#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long fast_pow(long long a, long long b) {
  if (b == 0) return 1 % 1000000007;
  long long k;
  k = fast_pow(a, b / 2);
  k = k * k % 1000000007;
  if (b % 2 == 0)
    return k;
  else
    return a * k % 1000000007;
}
long long max(long long a, long long b) {
  if (a < b) return b;
  return a;
}
vector<int> exam[100005];
int a[100005], temp[100005], n, m;
bool check(int x) {
  for (int i = 0; i < (x + 1); ++i) temp[i] = 0;
  for (int i = 1; i <= m; i++) {
    int y = exam[i].size();
    int k = -1, j;
    for (j = y - 1; j >= 0; j--)
      if (exam[i][j] <= x) {
        temp[exam[i][j]] = i;
        break;
      }
    if (j == -1) return false;
  }
  int j = -1;
  for (int i = 0; i < (x + 1); ++i) {
    if (temp[i] == 0)
      j++;
    else {
      if (a[temp[i]] <= j) {
        j -= a[temp[i]];
      } else
        return false;
    }
  }
  return true;
}
int main() {
  int x;
  cin >> n >> m;
  for (int i = 0; i < (n); ++i) {
    cin >> x;
    if (x > 0) exam[x].push_back(i + 1);
  }
  int low = 1, high = n, mid;
  for (int i = 0; i < (m); ++i) {
    cin >> a[i + 1];
  }
  int ans = -1;
  while (high - low > 1) {
    mid = (high + low) / 2;
    if (check(mid)) {
      ans = mid;
      high = mid;
    } else
      low = mid;
  }
  if (low + 1 == high) {
    if (check(low)) {
      ans = low;
    } else {
      if (check(high)) ans = high;
    }
  }
  cout << ans;
  return 0;
}
