#include <bits/stdc++.h>
using namespace std;
using std::string;
int a[1002], c[1002];
int main() {
  int n, m;
  cin >> n >> m;
  for (int(i) = 0; (i) < (n); ++(i)) cin >> c[i];
  for (int(i) = 0; (i) < (m); ++(i)) cin >> a[i];
  int j = 0, ans = 0;
  for (int(i) = 0; (i) < (n); ++(i)) {
    if (a[j] >= c[i]) {
      ans++;
      j++;
    }
  }
  cout << ans;
}
