#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int *a = new int[n];
  int *b = new int[m];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> b[i];
  }
  int c = 0, index = 0, j;
  bool flag = false;
  for (int i = 0; i < m; i++) {
    for (j = index; j < n; j++) {
      if (b[i] >= a[j]) {
        index = j + 1;
        c++;
        break;
      }
    }
    if (j == n) {
      break;
    }
  }
  cout << c;
  return 0;
}
