#include <bits/stdc++.h>
using namespace std;
struct node {
  long long val, vmin, delta;
  int tv, td;
};
int n, m;
int a[200033], d[200033];
long long s[200033];
pair<int, int> b[200033];
node tree[6 * 200033];
int find_pos(int l, int r, int x) {
  int p = -1;
  while (l <= r) {
    int mid = (l + r) / 2;
    if (x <= d[mid]) {
      p = mid;
      l = mid + 1;
    } else
      r = mid - 1;
  }
  return p;
}
void build_tree(int i, int l, int r) {
  tree[i].vmin = -1;
  tree[i].delta = 0;
  tree[i].tv = tree[i].td = 0;
  if (l == r) {
    tree[i].val = s[l];
    return;
  }
  int j = 2 * i, k = j + 1, mid = (l + r) / 2;
  build_tree(j, l, mid);
  build_tree(k, mid + 1, r);
  tree[i].val = min(tree[j].val, tree[k].val);
}
void up_vmin(int i) {
  int j = 2 * i;
  tree[j].vmin = tree[i].vmin;
  tree[j].tv = tree[i].tv;
  tree[j + 1].vmin = tree[i].vmin;
  tree[j + 1].tv = tree[i].tv;
  tree[i].val = min(tree[i].val, tree[i].vmin);
  tree[i].vmin = -1;
  tree[i].tv = 0;
}
void up_delta(int i) {
  int j = 2 * i;
  tree[j].delta += tree[i].delta;
  tree[j].td = tree[i].td;
  tree[j + 1].delta += tree[i].delta;
  tree[j + 1].td = tree[i].td;
  tree[i].val -= tree[i].delta;
  tree[i].delta = 0;
  tree[i].td = 0;
}
void up_node(int i) {
  if (tree[i].tv > 0 && tree[i].td > 0) {
    if (tree[i].tv < tree[i].td) {
      up_vmin(i);
      up_delta(i);
    } else {
      up_delta(i);
      up_vmin(i);
    }
  }
  if (tree[i].tv > 0) up_vmin(i);
  if (tree[i].td > 0) up_delta(i);
}
void update(int i, int l, int r, int u, int v, int t, int utype, long long x) {
  up_node(i);
  if (u > r || v < l) return;
  int j = 2 * i, k = j + 1;
  if (u <= l && v >= r) {
    if (utype == 1) {
      tree[i].val = min(tree[i].val, x);
      tree[j].vmin = x;
      tree[j].tv = t;
      tree[k].vmin = x;
      tree[k].tv = t;
      return;
    } else {
      tree[i].val -= x;
      tree[j].delta += x;
      tree[j].td = t;
      tree[k].delta += x;
      tree[k].td = t;
      return;
    }
  }
  int mid = (l + r) / 2;
  update(j, l, mid, u, v, t, utype, x);
  update(k, mid + 1, r, u, v, t, utype, x);
}
long long get(int i, int l, int r, int k) {
  up_node(i);
  if (l == r) return tree[i].val;
  int mid = (l + r) / 2;
  if (k <= mid)
    return get(2 * i, l, mid, k);
  else
    return get(2 * i + 1, mid + 1, r, k);
}
int main() {
  cin >> n >> m;
  s[0] = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    s[i] = a[i] + s[i - 1];
  }
  for (int i = 1; i <= m; i++) scanf("%d", &b[i].second);
  for (int i = 1; i <= m; i++) scanf("%d", &b[i].first);
  sort(b + 1, b + m + 1);
  d[n] = a[n];
  for (int i = n - 1; i >= 1; i--) d[i] = max(a[i], d[i + 1]);
  build_tree(1, 1, n);
  int res = 0;
  for (int i = 1; i <= m; i++) {
    int k = find_pos(1, n, b[i].second);
    if (k == -1) continue;
    long long money = get(1, 1, n, k);
    if (money >= b[i].first) {
      res++;
      long long rem = money - b[i].first;
      update(1, 1, n, 1, k, i, 1, rem);
      if (k < n) update(1, 1, n, k + 1, n, i, 2, b[i].first);
    }
  }
  cout << res << endl;
}
