#include <bits/stdc++.h>
using namespace std;
const long long int inf = (long long int)1e18;
const long long int mod = (long long int)1000000007;
template <typename T>
T modpow(T base, T exp, long long int modulus) {
  base %= modulus;
  T result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % modulus;
    base = (base * base) % modulus;
    exp >>= 1;
  }
  return result;
}
int main() {
  int n, m;
  cin >> n >> m;
  int c[n];
  int a[m];
  for (int i = 0; i < n; i++) {
    cin >> c[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> a[i];
  }
  int pc, pa;
  pc = 0;
  pa = 0;
  int ans = 0;
  while (pa < m && pc < n) {
    if (a[pa] >= c[pc]) {
      pa++;
      pc++;
      ans++;
    } else {
      pc++;
    }
  }
  cout << ans << endl;
  return 0;
}
