#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const double PI = acos(-1);
const double eps = 1e-6;
const int mod = 1e9 + 7;
const int maxn = 1e5 + 10;
int n, m;
int a[maxn], c[maxn];
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> c[i];
  }
  for (int i = 1; i <= m; i++) {
    cin >> a[i];
  }
  int j = 1, ans = 0;
  for (int i = 1; i <= n; i++) {
    if (a[j] >= c[i]) {
      ans++;
      j++;
    }
  }
  cout << ans << endl;
  return 0;
}
