#include <bits/stdc++.h>
using namespace std;
template <typename T>
void OutN(T x) {
  size_t i, len = x.size() - 1;
  for (i = 0; i < len; i++) cout << x[i] << " ";
  cout << x[len] << '\n';
}
template <typename T>
void Outit(T x) {
  auto end = x.end();
  end--;
  for (auto it = x.begin(); it != end; it++) cout << *it << " ";
  cout << *end << '\n';
}
template <typename T>
void Debug(const T &val) {
  cerr << val << '\n';
}
template <typename T, typename... Args>
void Debug(const T &val, Args... args) {
  cerr << val << ' ';
  Debug(std::forward<Args>(args)...);
}
template <typename T>
inline bool Max(T &x, const T &y) {
  return x < y ? x = y, 1 : 0;
}
template <typename T>
inline bool Min(T &x, const T &y) {
  return x > y ? x = y, 1 : 0;
}
template <typename T>
using V = vector<T>;
template <typename T>
using VV = V<V<T> >;
static const long long MOD = 1e9 + 7;
static const double PI = 3.141592653589793;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  int first[n];
  queue<int> q;
  int x;
  int ans = 0;
  int i;
  for ((i) = 0; (i) < (n); (i)++) cin >> first[i];
  for ((i) = 0; (i) < (m); (i)++) {
    cin >> x;
    q.push(x);
  }
  for ((i) = 0; (i) < (n); (i)++) {
    if (first[i] <= q.front()) {
      q.pop();
      ans++;
      if (q.empty()) break;
    }
  }
  cout << (ans) << '\n';
  return 0;
}
