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