#include <bits/stdc++.h>
using namespace std;
int arr[1000000], a[1000000];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 1; i <= m; i++) cin >> a[i];
  int start = 1, finish = n, mid;
  do {
    mid = (start + finish) / 2;
    set<int> si;
    for (int i = 0; i < mid; i++) {
      if (arr[i] != 0) si.insert(arr[i]);
    }
    if (si.size() == m) {
      bool is = true;
      map<int, int> mp;
      for (int i = 0; i < mid; i++) {
        if (arr[i] != 0) mp[arr[i]] = i;
      }
      vector<int> vi;
      for (auto x : mp) vi.push_back(x.second);
      sort(vi.begin(), vi.end());
      int hi = 0;
      for (int i = 0; i < vi.size(); i++) {
        if (vi[i] - hi >= a[arr[vi[i]]])
          hi += a[arr[vi[i]]] + 1;
        else
          is = false;
      }
      if (is)
        finish = mid - 1;
      else
        start = mid + 1;
    } else
      start = mid + 1;
  } while (start <= finish);
  for (int i = max(mid - 10, 1); i < mid + 10; i++) {
    set<int> si;
    for (int j = 0; j < i; j++) {
      if (arr[j] != 0) si.insert(arr[j]);
    }
    if (si.size() == m) {
      bool is = true;
      map<int, int> mp;
      for (int j = 0; j < i; j++) {
        if (arr[j] != 0) mp[arr[j]] = j;
      }
      vector<int> vi;
      for (auto x : mp) vi.push_back(x.second);
      sort(vi.begin(), vi.end());
      int hi = 0;
      for (int j = 0; j < vi.size(); j++) {
        if (vi[j] - hi >= a[arr[vi[j]]])
          hi += a[arr[vi[j]]] + 1;
        else
          is = false;
      }
      if (is) {
        cout << i;
        return 0;
      }
    }
  }
  cout << -1;
  return 0;
}
