#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> games(n);
  deque<int> bills(m);
  for (int i = 0; i < n; ++i) cin >> games[i];
  for (int i = 0; i < m; ++i) cin >> bills.at(i);
  int c = 0;
  for (int i = 0; i < n; ++i) {
    int x = games[i];
    if (bills.size() > 0 && x <= bills[0]) {
      c++;
      bills.pop_front();
    }
  }
  cout << c << endl;
  return 0;
}
