#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
const long long inf = 1LL << 60;
const int N = 100010;
inline void eq(void *x, void *y, int sz) {
  int i;
  for (i = 0; i < sz; ++i) *((char *)x + i) = *((char *)y + i);
}
inline void swap(void *x, void *y, int sz) {
  void *p;
  p = malloc(sz * sizeof(char));
  memset(p, *(int *)x, sz), memset(x, *(int *)y, sz), memset(y, *(int *)p, sz);
  free(p);
}
inline void My_qsort(void *base, int n, int sz,
                     int (*cmp)(const void *x, const void *y)) {
  if (n < 2) return;
  int i, j, r;
  void *s1[N];
  int s2[N], s3[N], head = 0;
  s1[++head] = base, s2[head] = n, s3[head] = sz;
  while (head) {
    j = 0, r = rand() % n;
    base = s1[head], n = s2[head], sz = s3[head], head--;
    if (n < 2) continue;
    swap(((char *)base + (0 * sz)), ((char *)base + (r * sz)), sz);
    for (i = 1; i < n; ++i)
      if (cmp(((char *)base + (i * sz)), ((char *)base + (0 * sz))) < 0)
        swap(((char *)base + (i * sz)), ((char *)base + (++j * sz)), sz);
    swap(((char *)base + (0 * sz)), ((char *)base + (j * sz)), sz);
    s1[++head] = base, s2[head] = j, s3[head] = sz;
    s1[++head] = (char *)base + ((j + 1) * sz), s2[head] = n - (j + 1),
    s3[head] = sz;
  }
}
struct Node {
  long long b, p;
  bool operator==(const Node &x) const { return b == x.b && p == x.p; }
  bool operator<(const Node &x) const {
    if (p != x.p)
      return p < x.p;
    else
      return b < x.b;
  }
} t[N];
int cmp(const void *x, const void *y) {
  Node _x = *(Node *)x, _y = *(Node *)y;
  if (_x == _y) return 0;
  return _x < _y ? -1 : 1;
}
int cmp_(const void *x, const void *y) {
  long long _x = *(long long *)x, _y = *(long long *)y;
  if (_x == _y) return 0;
  return _x < _y ? -1 : 1;
}
long long t1[N * 2], t2[N * 2], s[N * 2], a[N], sz, n, m;
int fa[N];
int ans(0);
int find_fa(int x) {
  if (x != fa[x]) fa[x] = find_fa(fa[x]);
  return fa[x];
}
void mod1(int x, long long y) {
  for (; x > 0; x -= (x & (-x))) t1[x] = max(t1[x], y);
}
long long que1(int x) {
  long long res(0);
  for (; x <= sz; x += (x & (-x))) res = max(res, t1[x]);
  return res;
}
void mod2(int x, long long y) {
  for (; x <= n; x += (x & (-x))) t2[x] += y;
}
long long que2(int x) {
  long long res(0);
  for (; x > 0; x -= (x & (-x))) res += t2[x];
  return res;
}
map<long long, int> M;
long long read() {
  long long w(0), f(0);
  char c = getchar();
  while ((c < '0' || c > '9') && c != '-') c = getchar();
  if (c == '-') f = 1, c = getchar();
  while (c >= '0' && c <= '9') w = w * 10 + c - '0', c = getchar();
  return f ? -w : w;
}
int main() {
  n = read(), m = read();
  long long pos, sum, tmp, pre;
  srand(time(0));
  for (int i = 1; i <= n; ++i) {
    a[i] = read(), s[i] = a[i], fa[i] = i;
  }
  for (int i = 1; i <= m; ++i) {
    t[i].b = read();
    s[n + i] = t[i].b;
  }
  for (int i = 1; i <= m; ++i) t[i].p = read();
  qsort(s + 1, n + m, sizeof(s[1]), cmp_);
  for (int i = 1; i <= n + m; ++i)
    if (!M[s[i]]) M[s[i]] = ++sz;
  for (int i = 1; i <= n; ++i) mod1(M[a[i]], i), mod2(i, a[i]);
  qsort(t + 1, m, sizeof(t[1]), cmp);
  for (int i = 1; i <= m; ++i) {
    pos = que1(M[t[i].b]);
    sum = que2(pos);
    if (sum >= t[i].p) {
      ans++;
      tmp = t[i].p;
      for (;;) {
        if (a[pos] >= tmp) {
          a[pos] -= tmp;
          mod2(pos, -tmp);
          tmp = 0;
        } else {
          tmp -= a[pos];
          mod2(pos, -a[pos]);
          a[pos] = 0;
        }
        if (a[pos] == 0) {
          pre = find_fa(pos - 1);
          fa[pos] = pre;
          pos = pre;
        }
        if (!tmp) break;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
