#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
const int mod = (int)1e9 + 7;
int a[N], b[N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) cin >> b[i];
  int j = 0;
  for (int i = 0; i < n; i++) {
    if (j == m) break;
    if (a[i] <= b[j]) {
      j++;
    }
  }
  cout << j;
  return 0;
}
