#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O3")
vector<string> vec_splitter(string s) {
  s += ',';
  vector<string> res;
  while (!s.empty()) {
    res.push_back(s.substr(0, s.find(',')));
    s = s.substr(s.find(',') + 1);
  }
  return res;
}
void debug_out(vector<string> __attribute__((unused)) args,
               __attribute__((unused)) int idx,
               __attribute__((unused)) int LINE_NUM) {
  cerr << endl;
}
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
  if (idx > 0)
    cerr << ", ";
  else
    cerr << "Line(" << LINE_NUM << ") ";
  stringstream ss;
  ss << H;
  cerr << args[idx] << " = " << ss.str();
  debug_out(args, idx + 1, LINE_NUM, T...);
}
inline long long int read() {
  long long int x = 0;
  static long long int p;
  p = 1;
  static char c;
  c = getchar();
  while (!isdigit(c)) {
    if (c == '-') p = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + (c - 48);
    c = getchar();
  }
  x *= p;
  return x;
}
void solve(int tt);
int main() {
  int tt = 1;
  for (long long int i = 0; i < (long long int)tt; i++) solve(i + 1);
}
void solve(int tt) {
  long long int n = read();
  long long int m = read();
  vector<long long int> arr(n);
  for (auto &a : arr) a = read();
  vector<long long int> arr2(m);
  for (auto &a : arr2) a = read();
  int cnt = 0;
  int idx = 0;
  for (auto a : arr) {
    if (idx == m) break;
    if (a <= arr2[idx]) {
      cnt++;
      idx++;
    }
  }
  cout << cnt << endl;
}
