#include <bits/stdc++.h>
using namespace std;
int a[100007], b[100007];
int n, m;
int i, j, k, l;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  for (i = 1; i <= n; i++) cin >> a[i];
  for (i = 1; i <= m; i++) cin >> b[i];
  int k = 1, sum = 0, f;
  for (i = 1; i <= m; i++) {
    f = 0;
    for (j = k; j <= n; j++) {
      if (a[j] <= b[i]) {
        f = 1;
        sum++;
        k = j + 1;
        break;
      }
    }
    if (f == 0) break;
  }
  cout << sum << endl;
}
