#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  int c[1001], v[1001];
  while (scanf("%d%d", &n, &m) != EOF) {
    for (int i = 0; i < n; i++) scanf("%d", &c[i]);
    for (int i = 0; i < m; i++) scanf("%d", &v[i]);
    int flag = 0;
    int sum = 0;
    int j = 0;
    for (int i = 0; i < m; i++) {
      for (; j < n; j++) {
        if (v[i] >= c[j]) {
          sum++;
          j++;
          break;
        }
      }
    }
    cout << sum << endl;
  }
  return 0;
}
