#include <bits/stdc++.h>
int compare(const void* a, const void* b) { return (*(int*)a - *(int*)b); }
int main(void) {
  long long int test, i, j, n, k, count, flag, flag2, b1, l, m, u, r, q, d, x,
      max, max2, min, f, sum, b, a[10000];
  scanf("%lld%lld", &n, &x);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  count = 0;
  k = 0;
  j = 0;
  for (i = 0; i < x; i++) {
    scanf("%lld", &f);
    for (j; j < n; j++) {
      if (a[j] <= f) {
        j++;
        count++;
        break;
      }
    }
    if (k == n) {
      break;
    }
  }
  printf("%lld", count);
  return 0;
}
