#include <bits/stdc++.h>
using namespace std;
long long n, m, exam[100001], prep[100001], ind[100001], i, l, r, mid, ans = -1,
                                                                       sum;
pair<long long, long long> p[100001];
bool answer(long long x) {
  for (i = 1; i <= x; i++) ind[exam[i]] = i;
  for (i = 1; i <= m; i++) {
    if (!ind[i]) return false;
    p[i] = make_pair(ind[i], prep[i]);
  }
  sort(p + 1, p + m + 1);
  long long temp = 0;
  for (i = 1; i <= m; i++) {
    if (p[i].second > p[i].first + p[i - 1].first + temp - 1)
      return false;
    else
      temp += p[i].first - p[i].second - 1;
  }
  return true;
}
int main() {
  cin >> n >> m;
  for (i = 1; i <= n; i++) cin >> exam[i];
  for (i = 1; i <= m; i++) cin >> prep[i], sum += prep[i];
  l = sum + m;
  r = n;
  while (l <= r) {
    mid = (l + r) / 2;
    if (answer(mid)) {
      r = mid - 1;
      ans = mid;
    } else
      l = mid + 1;
  }
  cout << ans << endl;
}
