#include <bits/stdc++.h>
using namespace std;
int main() {
  queue<int> q;
  int n, m, a[1010];
  ios::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  int c;
  for (int i = 1; i <= m; i++) {
    cin >> c;
    q.push(c);
  }
  int res = 0;
  for (int i = 1; i <= n; i++) {
    if (q.front() >= a[i]) {
      res++;
      q.pop();
      if (q.empty()) break;
    }
  }
  cout << res << endl;
  return 0;
}
