#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int b1[n];
  int b2[m];
  for (int k = 0; k < n; k++) {
    cin >> b1[k];
  }
  for (int l = 0; l < m; l++) {
    cin >> b2[l];
  }
  int a = 0;
  int i = 0;
  int s = 0;
  while (i < n && m > 0) {
    if (b2[0] >= b1[0]) {
      a = a + 1;
      b2[0] = b2[s + 1];
      b1[0] = b1[i + 1];
      m--;
      s++;
    } else {
      b1[0] = b1[i + 1];
    }
    i++;
  }
  cout << a;
  return 0;
}
