#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, temp;
  cin >> n >> m;
  queue<int> c;
  queue<int> a;
  for (int i = 0; i < n; i++) {
    cin >> temp;
    c.push(temp);
  }
  for (int i = 0; i < m; i++) {
    cin >> temp;
    a.push(temp);
  }
  int cnt = 0;
  while (c.size() != 0 && a.size() != 0) {
    if (c.front() <= a.front()) {
      c.pop();
      a.pop();
      cnt++;
    } else {
      c.pop();
    }
  }
  cout << cnt << endl;
  return 0;
}
