#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int c[n + 1], a[m + 1];
  for (int i = 1; i <= n; ++i) cin >> c[i];
  for (int i = 1; i <= m; ++i) cin >> a[i];
  int x = 1, z = 0;
  for (int i = 1; i <= n && x <= m; ++i) {
    if (c[i] <= a[x]) {
      z += 1;
      x += 1;
    }
  }
  cout << z;
}
