#include <bits/stdc++.h>
using namespace std;
vector<int> fu;
vector<long long> money;
vector<int> tranche;
int fuf(int x) {
  if (fu[x] == x) return x;
  return fu[x] = fuf(fu[x]);
}
void fuu(int a, int b) {
  a = fuf(a);
  b = fuf(b);
  if (a > b) swap(a, b);
  fu[b] = a;
}
int look_for(int x) {
  int p = 0, k = fu.size() - 1;
  while (p < k) {
    int s = (p + k + 1) / 2;
    if (tranche[s] >= x)
      p = s;
    else
      k = s - 1;
  }
  return p;
}
bool sub(int id, int x, int yet) {
  id = fuf(id);
  int s = min(money[id], (long long)x);
  money[id] -= s;
  x -= s;
  yet += s;
  if (x > 0) {
    assert(money[id] == 0);
    if (id == 0) {
      money[0] += yet;
      return false;
    }
    fuu(id - 1, id);
    return sub(id - 1, x, yet);
  }
  return true;
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  {
    vector<pair<int, long long>> s;
    for (int i = 0; i < n; i++) {
      int a;
      scanf("%d", &a);
      long long sum = a;
      while (not s.empty() && s.back().first <= a) {
        sum += s.back().second;
        s.pop_back();
      }
      s.push_back({a, sum});
    }
    for (int i = 0; i < s.size(); i++) {
      tranche.push_back(s[i].first);
      money.push_back(s[i].second);
      fu.push_back(i);
    }
  }
  vector<pair<int, int>> costs;
  costs.resize(m);
  for (int i = 0; i < m; i++) {
    scanf("%d", &costs[i].second);
  }
  for (int i = 0; i < m; i++) {
    scanf("%d", &costs[i].first);
  }
  {};
  sort(costs.begin(), costs.end());
  int res = 0;
  for (auto p : costs) {
    if (p.second > tranche[0]) continue;
    int id = look_for(p.second);
    res += sub(id, p.first, 0);
    {};
    {};
    {};
    {};
  }
  printf("%d\n", res);
}
