#include <bits/stdc++.h>
using namespace std;
int const N = 1e5 + 5;
int n, m, cnt;
int a[N], Q[N], Pre[N];
pair<int, int> b[N];
struct BIT {
  int tree[N];
  void update(int x, int val) {
    x = N - x - 1;
    while (x < N) {
      tree[x] = max(tree[x], val);
      x += x & (-x);
    }
  }
  int get(int x) {
    x = N - x - 1;
    int r = 0;
    while (x) {
      r = max(r, tree[x]);
      x -= x & (-x);
    }
    return r;
  }
};
BIT T;
struct BITSUM {
  long long tree[N];
  void update(int x, int val) {
    x++;
    while (x < N) {
      tree[x] += val;
      x += x & (-x);
    }
  }
  long long get(int x) {
    x++;
    long long r = 0;
    while (x) {
      r += tree[x];
      x -= x & (-x);
    }
    return r;
  }
};
BITSUM Tsum;
int getPos(int x) { return lower_bound(Q + 1, Q + cnt + 1, x) - Q; }
int getPre(int pos) {
  if (Pre[pos] == pos) return pos;
  return Pre[pos] = getPre(Pre[pos]);
}
void Delete(int pos) {
  int pre = getPre(pos - 1);
  Pre[pos] = pre;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    Q[++cnt] = a[i];
    Tsum.update(i, a[i]);
  }
  for (int i = 1; i <= m; i++) {
    cin >> b[i].second;
  }
  for (int i = 1; i <= m; i++) {
    cin >> b[i].first;
  }
  sort(Q + 1, Q + cnt + 1);
  for (int i = 1; i <= n; i++) {
    T.update(getPos(a[i]), i);
  }
  sort(b + 1, b + m + 1);
  for (int i = n + 1; i >= 0; i--) {
    Pre[i] = i;
  }
  int ans = 0;
  for (int i = 1; i <= m; i++) {
    int pos = T.get(getPos(b[i].second));
    pos = getPre(pos);
    int L = 0;
    int R = pos + 1;
    while (R - L > 1) {
      int X = (L + R) / 2;
      if (Tsum.get(pos) - Tsum.get(X - 1) <= b[i].first) {
        R = X;
      } else {
        L = X;
      }
    }
    int need = Tsum.get(pos) - Tsum.get(R - 1);
    if (L == 0 && need != b[i].first) {
      continue;
    }
    ans++;
    b[i].first -= need;
    a[L] -= b[i].first;
    Tsum.update(L, -b[i].first);
    while (pos > L) {
      Delete(pos);
      Tsum.update(pos, -a[pos]);
      a[pos] = 0;
      pos = getPre(pos);
    }
  }
  cout << ans;
}
