#include <bits/stdc++.h>
using namespace std;
const int OO = 0x3f3f3f3f, N = 1e5 + 5, mod = 1e9 + 7;
int n, m, c[N], arr[N], ans;
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; ++i) scanf("%d", c + i);
  for (int i = 0; i < m; ++i) scanf("%d", arr + i);
  for (int j = 0, i = 0; j < m && i < n;) {
    if (arr[j] >= c[i])
      ++ans, ++i, ++j;
    else
      ++i;
  }
  cout << ans;
  return 0;
}
