N,L = map(int,input().split())
h = sorted(map(int,input().split()))
for i in h:
    if L>=i:
        L+=1
print(L)

哈哈哈