#include <bits/stdc++.h>
using namespace std;
long long a[15005], b[10055], c, d, n, m, dd, r, rr, q, qq, k;
char x[171][454], y[100001];
string s;
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> b[i];
  }
  m--;
  for (int i = 0; i < n; i++) {
    if (a[i] <= b[d]) {
      d++;
      k++;
      if (d > m) return cout << k, 0;
    } else
      while (b[d] >= a[i]) {
        d++;
        if (d > m) return cout << k, 0;
      }
  }
  cout << k;
}
