#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + ch - '0';
    ch = getchar();
  }
  return f * x;
}
inline void write(long long a) {
  if (a < 0) putchar('-'), a = -a;
  if (a >= 10) write(a / 10);
  putchar(a % 10 + '0');
}
const int MAX_N = 1e3 + 10;
int n, m;
int a[MAX_N], b[MAX_N];
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 ans = 0;
  int pos = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] <= b[pos]) {
      pos++;
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
