#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
const long long inf = 1LL << 60;
const int N = 100010;
struct Node {
  long long b, p;
  bool operator<(const Node &x) const {
    if (p != x.p)
      return p < x.p;
    else
      return b < x.b;
  }
} t[N];
long long t1[N * 2], t2[N * 2], s[N * 2], a[N], sz, n, m;
int fa[N];
int ans(0);
int cmp_int(const void *a, const void *b) {
  return *(long long *)a - *(long long *)b;
}
int cmp_struct(const void *a, const void *b) {
  if ((*(struct Node *)a).p != (*(struct Node *)b).p)
    return (*(struct Node *)a).p - (*(struct Node *)b).p;
  else
    return (*(struct Node *)a).b - (*(struct Node *)b).b;
}
void qsort_new(void *a, int n, int siz,
               int (*fcmp)(const void *, const void *)) {
  int l = 0, r = n - 1, i;
  unsigned char key[siz];
  unsigned char *b = (unsigned char *)a;
  for (i = 0; i < siz; i++) key[i] = *(b + l * siz + i);
  if (n <= 1) return;
  while (l < r) {
    while (fcmp(b + r * siz, &key) >= 0 && l < r) r--;
    for (i = 0; i < siz; i++) *(b + l * siz + i) = *(b + r * siz + i);
    while (fcmp(&key, b + l * siz) >= 0 && l < r) l++;
    for (i = 0; i < siz; i++) *(b + r * siz + i) = *(b + l * siz + i);
  }
  for (i = 0; i < siz; i++) *(b + l * siz + i) = key[i];
  qsort_new(b, l, siz, fcmp);
  qsort_new(b + (l + 1) * siz, n - l - 1, siz, fcmp);
}
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;
  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_int);
  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_struct);
  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;
}
