#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  while (scanf("%d %d", &n, &m) != EOF) {
    int c[1002], a[1002];
    int i, j;
    for (i = 0; i < n; i++) {
      scanf("%d", &c[i]);
    }
    for (j = 0; j < m; j++) {
      scanf("%d", &a[j]);
    }
    int ans = 0;
    for (i = 0, j = 0; i < n && j < m;) {
      if (a[j] >= c[i]) {
        i++;
        j++;
        ans++;
      } else {
        i++;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
