#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200001;
long long arr[MAXN];
int l, r, x, n, m;
struct segTree {
  vector<long long> tree, lazy, mn;
  void init(int n) {
    tree.resize(4 * n + 1, 0);
    lazy.resize(4 * n + 1, 0);
    mn.resize(4 * n + 1, 0);
  }
  void push(int node, int st, int ed) {
    tree[node] += (lazy[node] * (ed - st + 1));
    mn[node] += lazy[node];
    if (st != ed) {
      lazy[node * 2] += lazy[node];
      lazy[node * 2 + 1] += lazy[node];
    }
    lazy[node] = 0;
  }
  void update(int node, int st, int ed, int l, int r, long long val) {
    push(node, st, ed);
    if (st > r || ed < l) return;
    if (st >= l && ed <= r) {
      lazy[node] += val;
      push(node, st, ed);
      return;
    }
    update(node * 2, st, (st + ed) / 2, l, r, val);
    update(node * 2 + 1, (st + ed) / 2 + 1, ed, l, r, val);
    tree[node] = tree[node * 2] + tree[node * 2 + 1];
    mn[node] = min(mn[node * 2], mn[node * 2 + 1]);
  }
  pair<long long, long long> query(int node, int st, int ed, int l, int r) {
    push(node, st, ed);
    if (st > r || ed < l) return {1e18, 0};
    if (st >= l && ed <= r) return {mn[node], tree[node]};
    auto L = query(node * 2, st, (st + ed) / 2, l, r);
    auto R = query(node * 2 + 1, (st + ed) / 2 + 1, ed, l, r);
    return make_pair(min(L.first, R.first), L.second + R.second);
  }
} seg;
int d[MAXN], suffix[MAXN];
pair<int, int> p[MAXN];
vector<int> deadline[MAXN];
int dead[MAXN];
bool cmp(pair<int, int> &p1, pair<int, int> &p2) {
  return p1.second < p2.second;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> d[i];
  }
  suffix[n] = d[n];
  for (int i = n - 1; i >= 1; i--) suffix[i] = max(suffix[i + 1], d[i]);
  for (int i = 1; i <= m; i++) cin >> p[i].first;
  for (int i = 1; i <= m; i++) cin >> p[i].second;
  sort(p + 1, p + m + 1, cmp);
  for (int i = 1; i <= m; i++) {
    int low = 1;
    int high = n;
    int when = -1;
    while (low <= high) {
      int mid = (low + high) / 2;
      if (suffix[mid] >= p[i].first) {
        low = mid + 1;
        when = max(mid, when);
      } else
        high = mid - 1;
    }
    if (when != -1) {
      deadline[when].push_back(i);
      dead[i] = when;
    } else
      dead[i] = -1;
  }
  seg.init(n);
  for (int i = 1; i <= n; i++) {
    seg.update(1, 1, n, i, n, d[i]);
  }
  int ans = 0;
  for (int i = 1; i <= m; i++) {
    if (dead[i] == -1) continue;
    long long mn = seg.query(1, 1, n, dead[i], n).first;
    if (mn < p[i].second) continue;
    ans++;
    seg.update(1, 1, n, dead[i], n, -p[i].second);
  }
  cout << ans;
  return 0;
}
