#include <bits/stdc++.h>
using namespace std;
int arr[100005], brr[100005];
int main() {
  int i1, i2, n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  for (int i = 1; i <= m; i++) cin >> brr[i];
  i2 = 1;
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (i2 > m) break;
    if (brr[i2] >= arr[i]) {
      i2++;
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
