#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
int n, m;
long long bit[MAXN];
long long tranch[MAXN];
long long ren[MAXN];
long long dem[MAXN];
int last[MAXN];
long long suff[MAXN];
int order[MAXN];
void update(int idx, long long val) {
  for (; idx < MAXN; idx += idx & -idx) {
    bit[idx] += val;
  }
}
long long query(int idx) {
  long long res = 0;
  for (; idx > 0; idx -= idx & -idx) {
    res += bit[idx];
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> tranch[i];
    update(i, tranch[i]);
  }
  for (int i = 1; i <= m; i++) {
    cin >> ren[i];
  }
  for (int i = 1; i <= m; i++) {
    cin >> dem[i];
  }
  for (int i = n; i > 0; i--) {
    suff[i] = max(suff[i + 1], tranch[i]);
  }
  for (int i = 1; i <= m; i++) {
    int lower = 0, upper = n, mid;
    while (lower < upper) {
      mid = (lower + upper + 1) / 2;
      if (suff[mid] >= ren[i]) {
        lower = mid;
      } else {
        upper = mid - 1;
      }
    }
    last[i] = lower;
  }
  set<int> s;
  for (int i = 1; i <= n; i++) {
    s.insert(i);
  }
  for (int i = 1; i <= m; i++) {
    order[i] = i;
  }
  sort(order + 1, order + 1 + m,
       [&](const int &lhs, const int &rhs) { return dem[lhs] < dem[rhs]; });
  int res = 0;
  for (int i = 1; i <= m; i++) {
    int curr = order[i];
    auto it = s.upper_bound(last[curr]);
    vector<int> to_remove;
    if (it != s.begin()) {
      it--;
      int idx = *it;
      if (query(idx) >= dem[curr]) {
        res++;
        while (dem[curr] > 0) {
          idx = *it;
          if (tranch[idx] > dem[curr]) {
            update(idx, -tranch[idx]);
            tranch[idx] -= dem[curr];
            update(idx, tranch[idx]);
            dem[curr] = 0;
          } else {
            update(idx, -tranch[idx]);
            dem[curr] -= tranch[idx];
            tranch[idx] = 0;
            to_remove.push_back(idx);
          }
          if (it != s.begin()) {
            it--;
          } else {
            assert(dem[curr] == 0);
          }
        }
      }
    }
    for (int idx : to_remove) {
      s.erase(idx);
    }
  }
  cout << res << '\n';
  return 0;
}
