#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 5;
int n, m, a[maxn], b[maxn], cnt = 1, ans;
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", &b[i]);
  for (int i = 1; i <= n; i++) {
    if (a[i] <= b[cnt]) {
      cnt++;
      ans++;
    }
    if (cnt > n) break;
  }
  printf("%d\n", ans);
  return 0;
}
