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