#include <bits/stdc++.h>
using namespace std;
int n, m, C[1001], A[1001], ans = 0;
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &C[i]);
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d", &A[i]);
  }
  for (int pos_a = 1, pos_c = 1; pos_a <= m && pos_c <= n; pos_c++) {
    if (C[pos_c] <= A[pos_a]) {
      ans++;
      pos_a++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
