#include <bits/stdc++.h>
using namespace std;
const long long inf = 1000000000000000ll;
long long b[230400], h[230400], d[230400], ans, t[230400], n, m;
struct node {
  long long c, e;
} a[230400];
struct seg {
  long long l, r, val, z;
} s[230400 * 4];
bool cmp(node u, node v) {
  if (u.c == v.c) return u.e < v.e;
  return u.c < v.c;
}
void build(long long p, long long l, long long r) {
  s[p].l = l;
  s[p].r = r;
  if (l == r) {
    s[p].val = t[l];
    s[p].z = 0;
    return;
  }
  long long mid = (l + r) >> 1;
  build(p << 1, l, mid);
  build((p << 1) | 1, mid + 1, r);
  s[p].val = min(s[p << 1].val, s[(p << 1) | 1].val);
  s[p].z = 0;
}
void pass(long long p) {
  s[p].val += s[p].z;
  if (s[p].l != s[p].r) s[p << 1].z += s[p].z, s[(p << 1) | 1].z += s[p].z;
  s[p].z = 0;
}
void update(long long p, long long l, long long r, long long w) {
  if (s[p].l > r || s[p].r < l) {
    pass(p);
    return;
  }
  if (s[p].l >= l && s[p].r <= r) {
    s[p].z += w;
    pass(p);
    return;
  }
  pass(p);
  update(p << 1, l, r, w);
  update((p << 1) | 1, l, r, w);
  s[p].val = min(s[p << 1].val, s[(p << 1) | 1].val);
}
long long qry(long long p, long long l, long long r) {
  pass(p);
  if (s[p].l > r || s[p].r < l) return inf;
  if (s[p].l >= l && s[p].r <= r) return s[p].val;
  return min(qry(p << 1, l, r), qry((p << 1) | 1, l, r));
}
int main() {
  scanf("%d%d", &n, &m);
  for (long long i = 1; i <= n; i++) scanf("%lld", &b[i]);
  d[n] = b[n];
  for (long long i = n - 1; i; i--) d[i] = max(d[i + 1], b[i]);
  for (long long i = 1; i <= n; i++) t[i] = t[i - 1] + b[i];
  build(1, 1, n);
  for (long long i = 0; i < m; i++) scanf("%lld", &a[i].e);
  for (long long i = 0; i < m; i++) scanf("%lld", &a[i].c);
  sort(a, a + m, cmp);
  for (long long i = 0; i < m; i++) {
    if (d[1] < a[i].e) continue;
    long long lf, rt, mid;
    lf = 0;
    rt = n + 1;
    while (rt - lf > 1) {
      mid = (lf + rt) >> 1;
      if (d[mid] < a[i].e)
        rt = mid;
      else
        lf = mid;
    }
    if (qry(1, lf, n) >= a[i].c) update(1, lf, n, -a[i].c), ans++;
  }
  cout << ans << endl;
}
