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