#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const int N = 1e5 + 10;
const LL INF = 1e18;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
LL n, m, pre[N], sums[N], tree[4 * N], lazy[4 * N], ans;
pair<LL, LL> a[N];
pair<LL, LL> bp[N];
vector<pair<LL, LL> > t;
vector<pair<LL, LL> > lb[N];
map<LL, multiset<LL> > h;
struct cmp {
  bool operator()(const pair<LL, LL>& lhs, const pair<LL, LL>& rhs) {
    return lhs.second < rhs.second;
  }
};
void build(int node, int start, int end) {
  if (start == end)
    tree[node] = t[start].first;
  else {
    int mid = (start + end) >> 1;
    build(node << 1, start, mid);
    build(node << 1 | 1, mid + 1, end);
    tree[node] = min(tree[node << 1], tree[node << 1 | 1]);
  }
}
void lupdate(int start, int end, int node) {
  tree[node] += lazy[node];
  if (start != end) {
    lazy[node << 1] += lazy[node];
    lazy[node << 1 | 1] += lazy[node];
  }
  lazy[node] = 0;
}
void updateRange(int node, int start, int end, int l, int r, LL val) {
  if (lazy[node] != 0) lupdate(start, end, node);
  if (start > end || start > r || end < l) return;
  if (start >= l && end <= r) {
    tree[node] += val;
    if (start != end) {
      lazy[node << 1] += val;
      lazy[node << 1 | 1] += val;
    }
    return;
  }
  int mid = (start + end) >> 1;
  updateRange(node << 1, start, mid, l, r, val);
  updateRange(node << 1 | 1, mid + 1, end, l, r, val);
  tree[node] = min(tree[node << 1], tree[node << 1 | 1]);
}
LL queryRange(int node, int start, int end, int l, int r) {
  if (start > end || start > r || end < l) return INF;
  if (lazy[node] != 0) lupdate(start, end, node);
  if (start >= l && end <= r) return tree[node];
  int mid = (start + end) >> 1;
  LL p1 = queryRange(node << 1, start, mid, l, r);
  LL p2 = queryRange(node << 1 | 1, mid + 1, end, l, r);
  return min(p1, p2);
}
int main() {
  scanf("%lld %lld", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i].first);
    a[i].second = i;
  }
  for (int i = 1; i <= m; i++) scanf("%lld", &bp[i].first);
  for (int i = 1; i <= m; i++) scanf("%lld", &bp[i].second);
  for (int i = 1; i <= n; i++) pre[i] = pre[i - 1] + a[i].first;
  sort(a + 1, a + 1 + n);
  reverse(a + 1, a + 1 + n);
  LL currIdx = a[1].second;
  t.push_back({pre[a[1].second], a[1].first});
  for (int i = 2; i <= n; i++) {
    if (a[i].second > currIdx)
      t.push_back({pre[a[i].second], a[i].first}), currIdx = a[i].second;
  }
  reverse(t.begin(), t.end());
  vector<LL> tmp;
  for (auto u : t) tmp.push_back(u.second);
  for (int i = 1; i <= m; i++) {
    int idx = lower_bound(tmp.begin(), tmp.end(), bp[i].first) - tmp.begin();
    if (idx == tmp.size()) continue;
    lb[idx].push_back(bp[i]);
    h[bp[i].second].insert(idx);
  }
  build(1, 0, t.size() - 1);
  for (auto u : h) {
    for (auto v : u.second) {
      LL val = queryRange(1, 0, t.size() - 1, 0, v);
      if (val >= u.first) {
        updateRange(1, 0, t.size() - 1, 0, v, -u.first);
        ans++;
      }
    }
  }
  printf("%lld\n", ans);
  return 0;
}
