#include <bits/stdc++.h>
using namespace std;
int c[100005], b[100005];
int main() {
  int n, m, i, j, ans;
  scanf("%d%d", &n, &m);
  for (i = 0; i < n; i++) scanf("%d", &c[i]);
  for (i = 0; i < m; i++) scanf("%d", &b[i]);
  j = 0, ans = 0;
  for (i = 0; i < n; i++)
    if (b[j] >= c[i]) ans++, j++;
  printf("%d\n", ans);
}
