#include <bits/stdc++.h>
using namespace std;
int n, m;
const int maxn = 1200;
int a[maxn], c[maxn];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= m; i++) scanf("%d", &c[i]);
  int i = 1, j = 1;
  int ans = 0;
  while (i <= n && j <= m) {
    if (a[i] <= c[j])
      i++, j++, ans++;
    else
      i++;
  }
  printf("%d", ans);
  return 0;
}
