#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
int n, m, a[N], c[N], pter = 1, ans;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) cin >> c[i];
  for (int i = 1; i <= m; ++i) cin >> a[i];
  for (int i = 1; i <= m; ++i) {
    while (pter <= n && c[pter] > a[i]) pter++;
    if (pter > n) break;
    ans++;
    pter++;
  }
  cout << ans;
  return 0;
}
