#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
int n, m, c[N], a[N], ans;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> c[i];
  }
  for (int i = 1; i <= m; i++) {
    cin >> a[i];
  }
  for (int i = 1, j = 1; i <= n; i++) {
    if (c[i] <= a[j]) {
      ans++;
      j++;
    }
  }
  cout << ans;
  return 0;
}
