#include <bits/stdc++.h>
int main() {
  int n, m, res = 0;
  scanf("%d %d", &n, &m);
  int a[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  int j = 0;
  for (int i = 0; i < m; i++) {
    int b;
    scanf("%d", &b);
    for (; j < n; j++) {
      if (a[j] <= b) {
        res++;
        j++;
        break;
      }
    }
  }
  printf("%d", res);
  return 0;
}
