#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int arr[n];
  for (int i = 0; i < n; ++i) cin >> arr[i];
  int ans = 0;
  int j = 0;
  for (int i = 0; i < m; ++i) {
    int x;
    cin >> x;
    for (j; j < n; ++j)
      if (x >= arr[j]) {
        ans++;
        break;
      }
    j++;
  }
  cout << ans;
  return 0;
}
