STAND_TOTAL, CASE_TOTAL = map(int, input().split()) STRENGTHS = list(map(int, input().split())) TIMES = list(map(int, input().split())) def main(): STRENGTHS.sort() ok, ng = 0, CASE_TOTAL + 1 while abs(ok - ng) > 1: med = (ok + ng) // 2 if judge(med): ok = med else: ng = med print(ok) def judge(x): if x == 0: return True sub_times = [TIMES[case_i] for case_i in range(x)] sub_times.sort() case_i = 0 for strength in STRENGTHS: time = sub_times[case_i] if strength >= time: case_i += 1 if case_i >= x: break return case_i >= x if __name__ == "__main__": main()