#include <bits/stdc++.h>
using namespace std;
int c[1000];
int a[1000];
int main() {
  int n, m;
  while (~scanf("%d %d", &n, &m)) {
    for (int i = 0; i < n; i++) {
      scanf("%d", &c[i]);
    }
    for (int i = 0; i < m; i++) {
      scanf("%d", &a[i]);
    }
    int pos = 0;
    int ans = 0;
    for (int i = 0; i < n; i++) {
      if (pos < m && c[i] <= a[pos]) {
        ans++;
        pos++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
