#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-16;
const int MOD = 1e9 + 7;
const long long OO = 1e18;
const int N = 1e5 + 5;
int c[1001], a[1001];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; ++i) cin >> c[i];
  for (int i = 0; i < m; ++i) cin >> a[i];
  int ans = 0, i = 0, j = 0;
  while (i < m && j < n) {
    bool ok = 0;
    while (j < n) {
      if (a[i] >= c[j]) {
        ok = 1;
        c[j] = 100000;
        ans++;
        j++;
        break;
      }
      j++;
    }
    i++;
    if (!ok) break;
  }
  cout << ans;
}
