#include <bits/stdc++.h>
bool debug = 1;
const long long MOD = 1000000007;
const double PI = acos(-1.0);
const double eps = 1e-9;
using namespace std;
int main() {
  int n, m;
  int c[100100], a[100100];
  cin >> 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 j = 0;
  for (int i = 0; i < n; i++) {
    if (j < m and c[i] <= a[j]) j++;
  }
  cout << j << endl;
  return 0;
}
