#include <bits/stdc++.h>
using namespace std;
int v[1001], v2[1001];
int main() {
  int n, m, i, j, nr, cnt = 0, bill;
  bool cazan = true;
  cin >> n >> m;
  for (i = 1; i <= n; i++) cin >> v[i];
  for (i = 1; i <= m; i++) cin >> v2[i];
  j = 1;
  for (i = 1; i <= n; i++) {
    if (cazan == true) bill = v2[j++];
    if (bill < v[i])
      cazan = false;
    else {
      cazan = true;
      cnt++;
    }
  }
  cout << cnt;
  return 0;
}
