#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * f;
}
int n, m;
int a[1010];
int b[1010];
int main() {
  n = read(), m = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  for (int i = 1; i <= m; i++) b[i] = read();
  int ans = 0;
  int nw = 1;
  for (int i = 1; i <= n; i++) {
    if (b[nw] >= a[i]) {
      ans++;
      nw++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
