#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int n, m;
  cin >> n >> m;
  int cost[n + 5], note[m + 5];
  for (int i = 0; i < n; i++) cin >> cost[i];
  for (int j = 0; j < m; j++) cin >> note[j];
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (count < m && cost[i] <= note[count]) {
      count++;
    }
  }
  cout << count;
  return 0;
}
