#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e4 + 100;
int c[maxn], a[maxn];
int main() {
  int n, m, l = 0, ans = 0;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> c[i];
  for (int i = 0; i < m; i++) cin >> a[i];
  for (int i = 0; i < n; i++)
    if (a[l] >= c[i]) {
      ans++;
      l++;
    }
  cout << ans;
  return 0;
}
