#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, a[1001], b[1001], c = 0, x;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> b[i];
  }
  for (int i = 0; i < n; i++) {
    x = b[c];
    if (a[i] <= x) {
      c++;
    }
  }
  cout << c;
}
