#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int arr1[n], arr2[m];
  for (int i = 0; i < n; i++) {
    cin >> arr1[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> arr2[i];
  }
  int k = arr2[0];
  int ans = 0, l = 0;
  for (int i = 0; i < n; i++) {
    if (k >= arr1[i]) {
      ans++;
      if (l < m - 1) {
        k = arr2[++l];
      } else {
        break;
      }
    }
  }
  cout << ans;
  return 0;
}
