#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  int a[1005], c[1005];
  for (int i = 0; i < (n); ++i) cin >> c[i];
  for (int i = 0; i < (m); ++i) cin >> a[i];
  int cnt = 0, cur = 0;
  for (int i = 0; i < (n); ++i) {
    if (a[cur] >= c[i]) {
      cnt++;
      cur++;
    }
    if (cur >= m) break;
  }
  cout << cnt << '\n';
}
