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