#include <bits/stdc++.h>
int a[1005], c[1005];
int n, m;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d", &c[i]);
  }
  int i = 1, j = 1;
  int sum = 0;
  while (j <= m && i <= n) {
    if (c[j] >= a[i]) {
      sum++;
      j++;
      i++;
    } else {
      i++;
    }
  }
  printf("%d\n", sum);
}
