#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, a[1000], b[1000], i, ans = 0;
  cin >> n >> m;
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < m; ++i) cin >> b[i];
  for (i = 0; i < n & ans < m; ++i)
    if (a[i] <= b[ans]) ++ans;
  cout << ans;
  return 0;
}
