#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int a[n], b[m];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> b[i];
  }
  int g = 0;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (g == m) break;
    if (a[i] <= b[g]) {
      g++;
      ans++;
    }
  }
  cout << ans;
}
