#include <bits/stdc++.h>
using namespace std;
const int MIN = 2e3 + 2;
const int MXN = 1e6 + 3;
const int INF = 1e9 + 7;
const int base = 1e9;
const long long LINF = 1e18 + 15;
const double EPS = 1e-9;
int n, m;
int a[MXN], b[MXN];
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 >> a[i];
  }
  for (int i = 1; i <= m; ++i) {
    cin >> b[i];
  }
  int l = 1, ans = 0;
  for (int i = 1; i <= n; ++i) {
    if (l > m) break;
    if (b[l] >= a[i]) {
      l++;
    }
  }
  cout << l - 1;
  return 0;
}
