#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
const int maxint = 0x3f3f3f3f;
const int mod = 1e9 + 7;
int n, m, i, j, a[maxn], b[maxn];
int main() {
  cin >> n >> m;
  for (i = 1; i <= n; i++) cin >> a[i];
  for (i = 1; i <= m; i++) cin >> b[i];
  i = 1;
  for (j = 1; j <= m; j++) {
    while (i <= n && a[i] > b[j]) i++;
    if (i > n) break;
    i++;
  }
  cout << j - 1 << "\n";
  return 0;
}
