#include <bits/stdc++.h>
using namespace std;
const int inf = 1e6;
const int Linf = 1e9;
const long long LLinf = (long long)1e18;
const int maxn = 1e6;
int n, m, a[maxn], b[maxn];
void Enter() {
  cin >> n >> m;
  for (int i = (1); i <= (n); ++i) cin >> a[i];
  for (int j = (1); j <= (m); ++j) cin >> b[j];
  int i = 1;
  int j = 1;
  int d = 0;
  while (i <= n && j <= m) {
    if (a[i] <= b[j]) {
      ++j;
      d++;
    }
    ++i;
  }
  cout << d;
}
void Init() {}
void Solve() {}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  Enter();
  Init();
  Solve();
}
