#include <bits/stdc++.h>
using namespace std;
int a[100005];
int d[100005];
int b[100005];
int e[100005];
int chk[100005];
vector<pair<int, int> > v;
int main() {
  int n, m;
  cin >> n >> m;
  int i;
  for (i = 1; i <= n; i++) {
    cin >> d[i];
  }
  for (i = 1; i <= m; i++) {
    cin >> a[i];
  }
  a[0] = 0;
  int net = 1000000;
  int l = 1;
  int r = n;
  while (l <= r) {
    if (l == r) {
      int mid = (l + r) / 2;
      v.resize(0);
      for (i = 1; i <= m; i++) {
        chk[i] = 0;
      }
      for (i = mid; i >= 1; i--) {
        if (d[i] == 0) continue;
        if (chk[d[i]] == 0) {
          chk[d[i]] = 1;
          v.push_back(make_pair(a[d[i]], i));
        }
      }
      if (v.size() < m) {
        l = mid + 1;
        break;
      }
      int tmp = 0;
      int flag = 1;
      int j = 0;
      for (i = v.size() - 1; i >= 0; i--) {
        j++;
        tmp += v[i].first;
        if (v[i].second < tmp + j) {
          flag = 0;
        }
      }
      if (flag == 1) {
        net = min(net, mid);
        r = mid - 1;
      } else {
        l = mid + 1;
      }
      break;
    }
    int mid = (l + r) / 2;
    v.resize(0);
    for (i = 1; i <= m; i++) {
      chk[i] = 0;
    }
    for (i = mid; i >= 1; i--) {
      if (d[i] == 0) continue;
      if (chk[d[i]] == 0) {
        chk[d[i]] = 1;
        v.push_back(make_pair(a[d[i]], i));
      } else {
      }
    }
    if (v.size() < m) {
      l = mid + 1;
      continue;
    }
    int tmp = 0;
    int flag = 1;
    int j = 0;
    for (i = v.size() - 1; i >= 0; i--) {
      j++;
      tmp += v[i].first;
      if (mid == 6) {
      }
      if (v[i].second < tmp + j) {
        flag = 0;
      }
    }
    if (flag == 1) {
      net = min(net, mid);
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  if (net == 1000000) {
    cout << "-1" << endl;
  } else {
    cout << net << endl;
  }
  return 0;
}
