#include <bits/stdc++.h>
using namespace std;
inline bool checkBit(long long n, long long i) {
  return n & ((long long)1 << i);
}
inline long long setBit(long long n, long long i) {
  return n | ((long long)1 << i);
  ;
}
inline long long resetBit(long long n, long long i) {
  return n & (~((long long)1 << i));
}
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
inline bool isLeapYear(long long year) {
  return (year % 400 == 0) || (year % 4 == 0 && year % 100 != 0);
}
inline void normal(long long &a) { a = (a + 998244853) % 998244853; }
inline long long modMul(long long a, long long b) {
  a %= 998244853, b %= 998244853;
  normal(a), normal(b);
  return (a * b) % 998244853;
}
inline long long modAdd(long long a, long long b) {
  a %= 998244853, b %= 998244853;
  normal(a), normal(b);
  return (a + b) % 998244853;
}
inline long long modSub(long long a, long long b) {
  a %= 998244853, b %= 998244853;
  normal(a), normal(b);
  a -= b;
  normal(a);
  return a;
}
inline long long modPow(long long b, long long p) {
  long long r = 1;
  while (p) {
    if (p & 1) r = modMul(r, b);
    b = modMul(b, b);
    p >>= 1;
  }
  return r;
}
inline long long modInv(long long a) { return modPow(a, 998244853 - 2); }
inline long long modDiv(long long a, long long b) {
  return modMul(a, modInv(b));
}
inline long long fact(long long r) {
  long long ans = 1;
  while (r) ans = modMul(ans, r), r--;
  return ans;
}
inline long long invfact(long long r) {
  long long ans = 1;
  while (r) ans = modMul(ans, modInv(r)), r--;
  return ans;
}
inline double dgcd(double a, double b) {
  if (a < b) return dgcd(b, a);
  if (b < .0001) return a;
  return dgcd(b, fmod(a, b));
}
void solve() {
  long long n, m;
  cin >> n >> m;
  long long a[n], b[m];
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long j = 0; j < m; j++) cin >> b[j];
  long long i = 0, j = 0, ans = 0;
  while (i < n && j < m) {
    if (a[i] <= b[j]) {
      ans++, i++, j++;
    } else
      i++;
  }
  cout << ans << endl;
}
signed main() {
  clock_t start, end;
  start = clock();
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t = 1;
  while (t--) {
    solve();
  }
  end = clock();
  double T = double(end - start) / double(CLOCKS_PER_SEC);
}
