#include <bits/stdc++.h>
int a[1010], b[1010];
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", &b[i]);
  int t = 1, ans = 0;
  for (int i = 1; i <= n && t <= m; i++)
    if (b[t] >= a[i]) {
      ans++;
      t++;
    }
  printf("%d\n", ans);
  return 0;
}
