#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  vector<int> V(n);
  vector<int>::iterator it;
  vector<int> W(m);
  for (auto &a : V) cin >> a;
  for (auto &a : W) cin >> a;
  int curr = 0;
  int ans = 0;
  int top = W.at(curr);
  for (int i = 0; i < n; ++i) {
    it = find_if(V.begin() + i, V.end(),
                 [top](const int b) { return top >= b; });
    if (it != V.end()) {
      ++ans;
      i = static_cast<int>(it - V.begin());
      ++curr;
      if (curr == m) break;
      top = W.at(curr);
    }
  }
  cout << ans;
}
