#include <bits/stdc++.h>
using namespace std;
int n, m;
int temp1[1005];
int temp2[1005];
int t1, t2;
int ans;
int main() {
  t1 = 1;
  t2 = 1;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &temp1[i]);
  }
  for (int i = 1; i <= m; ++i) {
    scanf("%d", &temp2[i]);
  }
  while (t1 <= n && t2 <= m) {
    if (temp1[t1] <= temp2[t2]) {
      ans++;
      t1++;
      t2++;
    } else {
      t1++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
