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