#include <bits/stdc++.h>
using namespace std;
const int ts = 1 << 18, to = (1 << 17) - 1;
long long n, m, a[100000], b[100000], p[100000], ma[100000], pos[100000],
    f[100001], s[100000];
long long t[ts], u[ts];
void calc(int x) {
  t[x] = min(t[(2 * (x) + 1)] + u[(2 * (x) + 1)],
             t[(2 * (x) + 2)] + u[(2 * (x) + 2)]);
}
void build() {
  for (int x = to - 1; x >= 0; x--) calc(x);
}
void update(int a, int b, long long c, int l = 0, int r = 1 << 17, int x = 0) {
  if (a <= l && r <= b) {
    u[x] += c;
    return;
  }
  if (b <= l || r <= a) return;
  int mid = (l + r) / 2;
  update(a, b, c, l, mid, (2 * (x) + 1));
  update(a, b, c, mid, r, (2 * (x) + 2));
  calc(x);
}
long long query(int a, int b, int l = 0, int r = 1 << 17, int x = 0) {
  if (a <= l && r <= b) return t[x] + u[x];
  if (b <= l || r <= a) return 1000000000000000000ll;
  int mid = (l + r) / 2;
  return min(query(a, b, l, mid, (2 * (x) + 1)),
             query(a, b, mid, r, (2 * (x) + 2))) +
         u[x];
}
void change(int i, long long d) {
  i++;
  for (; i <= n; i += (i & (-i))) f[i] += d;
}
long long getSum(int i) {
  i++;
  long long sum = 0;
  for (; i; i -= (i & (-i))) sum += f[i];
  return sum;
}
bool cmp(int i, int j) {
  if (p[i] != p[j]) return p[i] < p[j];
  return pos[i] > pos[j];
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    cin >> a[i], change(i, a[i]), t[to + i] = getSum(i);
  build();
  ma[n - 1] = a[n - 1];
  for (int i = n - 2; i >= 0; i--) ma[i] = max(a[i], ma[i + 1]);
  for (int i = 0; i < m; i++) cin >> b[i];
  for (int i = 0; i < m; i++) cin >> p[i];
  for (int i = 0; i < m; i++) {
    s[i] = i;
    int l = 0, r = n - 1;
    while (l < r) {
      int mid = (l + r + 1) / 2;
      if (ma[mid] >= b[i])
        l = mid;
      else
        r = mid - 1;
    }
    if (ma[l] >= b[i])
      pos[i] = l;
    else
      pos[i] = -1;
  }
  sort(s, s + m, cmp);
  int d = 0;
  for (int i = 0; i < m; i++) {
    if (pos[s[i]] != -1 && getSum(pos[s[i]]) >= p[s[i]] &&
        query(pos[s[i]], n) >= p[s[i]]) {
      change(pos[s[i]], -p[s[i]]);
      update(pos[s[i]], n, -p[s[i]]);
      d++;
    }
  }
  cout << d << "\n";
}
