#include <bits/stdc++.h>
using namespace std;
int main() {
  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 j = 0, cnt = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] <= c[j]) {
      j++;
      cnt++;
    }
    if (j == m) break;
  }
  cout << cnt;
}
