#include <bits/stdc++.h>
int c[12345], d[12345];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%d", &c[i]);
  for (int i = 0; i < m; i++) scanf("%d", &d[i]);
  int p1 = 0;
  int p2 = 0;
  int ans = 0;
  while (1) {
    if (p1 >= n || p2 >= m) break;
    if (c[p1] <= d[p2]) {
      ans++;
      p1++;
      p2++;
    } else
      p1++;
  }
  printf("%d", ans);
  return 0;
}
