#include <bits/stdc++.h>
using namespace std;
long long n, m, tot, ans;
long long a[100011];
struct node {
  long long b, d;
  bool operator<(const node &xx) const { return b < xx.b; }
} p[100011];
priority_queue<long long, vector<long long>, greater<long long> > q;
long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * f;
}
void write(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10) write(x / 10);
  putchar(x % 10 + '0');
}
void writern(long long x) { write(x), putchar(' '); }
void writeln(long long x) { write(x), puts(""); }
bool cmp(const long long &xa, const long long &xb) { return p[xa].d < p[xb].d; }
int main() {
  n = read(), m = read();
  for (long long i = 1; i <= n; i++) a[i] = read();
  for (long long i = 1; i <= m; i++) p[i].b = read();
  for (long long i = 1; i <= m; i++) p[i].d = read();
  sort(p + 1, p + m + 1);
  long long x, pos = 0;
  for (long long i = n; i; i = x - 1) {
    x = i;
    tot = a[i];
    while (a[x - 1] <= a[i] && x > 1) tot += a[--x];
    while (pos < m && p[pos + 1].b <= a[i]) q.push(p[++pos].d);
    while (!q.empty()) {
      if (tot >= q.top()) {
        ans++, tot -= q.top();
        q.pop();
      } else {
        long long tmp = q.top() - tot;
        q.pop();
        q.push(tmp);
        tot = 0;
        break;
      }
    }
  }
  writeln(ans);
  return 0;
}
