#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, *a, *c;
  cin >> n >> m;
  a = new int[m];
  c = new int[n];
  for (int i = 0; i < n; ++i) scanf("%d", &c[i]);
  for (int i = 0; i < m; ++i) scanf("%d", &a[i]);
  int j = 0, count = 0;
  for (int i = 0; i < n; ++i) {
    if (j < m && c[i] <= a[j]) {
      count++, j++;
    }
  }
  cout << count << "\n";
  delete[] a;
  delete[] c;
}
