#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, A, C;
  cin >> n >> m;
  queue<int> a;
  vector<int> c;
  while (n--) {
    cin >> C;
    c.push_back(C);
  }
  while (m--) {
    cin >> A;
    a.push(A);
  }
  int answer = 0;
  for (vector<int>::iterator it = c.begin(), et = c.end();
       it != et && !a.empty(); ++it) {
    int z = a.front();
    if (z >= *it) {
      ++answer;
      a.pop();
    }
  }
  cout << answer << endl;
}
