#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int c[n];
  int a[m];
  for (int i = 0; i < n; i++) cin >> c[i];
  for (int j = 0; j < m; j++) cin >> a[j];
  int i = 0, j = 0, ans = 0;
  multiset<int> temp;
  while (i < n && j < m) {
    if (c[i] <= a[j]) {
      ans++;
      i++;
      j++;
    } else {
      i++;
    }
  }
  cout << ans;
  return 0;
}
