#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, m;
  cin >> n >> m;
  vector<int> c, a;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    c.push_back(x);
  }
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    a.push_back(x);
  }
  int index = 0;
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (a[index] >= c[i]) {
      count++;
      index++;
    }
    if (index == m) break;
  }
  cout << count;
}
int main() {
  int T = 1;
  while (T--) {
    solve();
  }
}
