#include <bits/stdc++.h>
using namespace std;
const int maxN = 1000 + 9;
int n, m;
int a[maxN];
int b[maxN];
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < m; i++) scanf("%d", &b[i]);
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] <= b[cnt]) cnt++;
    if (cnt == m) break;
  }
  printf("%d\n", cnt);
  return 0;
}
