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