#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int c[n], b[m];
  for (int i = 0; i < n; i++) cin >> c[i];
  for (int i = 0; i < m; i++) cin >> b[i];
  int count = 0, i = 0, j = 0;
  while (i != n && j != m) {
    if (b[j] >= c[i]) {
      count++;
      j++;
    }
    i++;
  }
  cout << count;
  return 0;
}
