#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long n, m, answer = 0;
  cin >> n >> m;
  deque<long long> c(n), a(m);
  for (long long i = 0; i < n; ++i) {
    cin >> c[i];
  }
  for (long long i = 0; i < m; ++i) {
    cin >> a[i];
  }
  for (long long i = 0; i < n; ++i) {
    if (a.size() > 0 && a[0] >= c[i]) {
      a.pop_front();
      ++answer;
    }
  }
  cout << answer;
  return 0;
}
