D, N = [int(x) for x in input().split()]
ovens = [int(x) for x in input().split()]
doughs = [int(x) for x in input().split()]
rlt = list()
is_exit = False
for i in range(D-1, -1, -1):
if doughs and ovens[i] > doughs[0]:
doughs.pop(0)
rlt.append(i)
is_exit = True
elif doughs:
continue
else:
break
if is_exit:
print(rlt[-1]+1)
else:
print(0)