#include <bits/stdc++.h>
int c[1005];
int d[1005];
using namespace std;
int main() {
  int n, m;
  int i, j;
  int ct = 0;
  scanf("%d %d", &n, &m);
  for (i = 0; i < n; i++) scanf("%d", &c[i]);
  for (j = 0; j < m; j++) scanf("%d", &d[j]);
  int e = 0;
  for (j = 0; j < m; j++) {
    while (e < n) {
      if (d[j] >= c[e]) {
        ct++;
        e++;
        break;
      } else
        e++;
    }
    if (d[j] == c[e] && e == n) break;
  }
  printf("%d", ct);
}
