#include <bits/stdc++.h>
#pragma GCC optimize(3)
using namespace std;
const long long llINF = 9223372036854775807;
const int INF = 2147483647;
const int maxn = 1e3 + 7;
const int maxm = 1e5 + 7;
const int mod = 1e9 + 7;
int n, m;
int c[maxn], a[maxn];
int main(int argc, char const *argv[]) {
  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]);
  int p = 1, cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (a[p] >= c[i]) {
      cnt++;
      p++;
    }
  }
  printf("%d\n", cnt);
  return 0;
}
