#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int c[n];
  for (int i = 0; i < n; i++) cin >> c[i];
  vector<int> b(m);
  for (int i = 0; i < m; i++) cin >> b[i];
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (b.empty()) break;
    if (b[0] >= c[i]) {
      count++;
      b.erase(b.begin() + 0);
    } else {
      continue;
    }
  }
  cout << count;
  return 0;
}
