#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1050;
int n, m, C[MAXN], A[MAXN];
int main() {
  while (scanf("%d %d", &n, &m) >= 1) {
    for (int i = (0); i < (int)(n); i++) scanf("%d", &C[i]);
    for (int i = (0); i < (int)(m); i++) scanf("%d", &A[i]);
    int p = 0;
    for (int i = (0); i < (int)(n); i++) {
      if (p < m && C[i] <= A[p]) p++;
    }
    printf("%d\n", p);
  }
  return 0;
}
