#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i;
  vector<int> a;
  cin >> n >> m;
  deque<int> dq;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    a.push_back(x);
  }
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    dq.push_back(x);
  }
  int cnt = 0;
  int k = 0;
  for (int i = 0; i < n; i++) {
    k = dq.front();
    if (a[i] <= k) {
      if (dq.size() == 0) break;
      dq.pop_front();
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
