#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 555;
int n, m;
int a[maxn], b[maxn];
int main() {
  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 i1 = 1, i2 = 1;
  int res = 0;
  while (i1 <= n && i2 <= m) {
    if (a[i1] <= b[i2])
      i1++, i2++, res++;
    else
      i1++;
  }
  printf("%d\n", res);
  return 0;
}
