import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto M = s[1];
    auto C = readln.split.map!(to!int).array;
    auto A = readln.split.map!(to!int).array;
    int ans = 0;

    for (int i = 0, p = 0; i < N && p < M; ++i) {
        if (C[i] <= A[p]) {
            ans += 1;
            p += 1;
        }
    }

    ans.writeln;
}
