#include <bits/stdc++.h>
using namespace std;
int main(void) {
  ios::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  int a[n], c[m];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < m; i++) cin >> c[i];
  int count = 0, temp = 0;
  for (int i = 0; i < n && temp < m; ++i) {
    if (c[temp] >= a[i]) {
      count++;
      temp++;
    }
  }
  cout << count;
}
