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