#include <bits/stdc++.h>
using namespace std;
const double pi = 3.14159265358979323846;
long long mod = 1000000007;
int mul(int x, int y) { return (x * 1ll * y) % mod; }
long long power(long long x, long long y) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) res = (res * x) % mod;
    y = y >> 1;
    x = (x * x) % mod;
  }
  return res % mod;
}
int inv(int x) { return power(x, mod - 2); }
int divide(int x, int y) { return mul(x, inv(y)); }
int fact[200001];
void precalc() {
  fact[0] = 1;
  for (int i = 1; i < 200001; i++) fact[i] = mul(fact[i - 1], i);
}
int C(int n, int k) { return divide(fact[n], mul(fact[k], fact[n - k])); }
const int dx[] = {-1, -1, 1, 1};
const int dy[] = {1, 0, 0, 1};
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << fixed;
  cout.precision(12);
  int q = 1;
  while (q--) {
    int n, m;
    cin >> n >> m;
    int c[n], a[m];
    for (int i = 0; i < n; i++) cin >> c[i];
    for (int i = 0; i < m; i++) cin >> a[i];
    int k = 0, ans = 0;
    for (int i = 0; i < n; i++) {
      if (k >= m) break;
      if (c[i] <= a[k]) {
        ans++;
        k++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
