#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1010;
int c[MAXN], a[MAXN];
int top;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int m = 0, n = 0;
  while (cin >> n >> m) {
    for (int i = 1; i <= n; i++) cin >> c[i];
    for (int i = 1; i <= m; i++) cin >> a[i];
    top = 1;
    int cnt = 0;
    for (int i = 1; i <= n; i++) {
      if (a[top] >= c[i]) {
        cnt++;
        top++;
      }
    }
    cout << cnt << endl;
  }
  return 0;
}
