升序排序,然后遍历,遇到大于等于x就退出循环

n,x = map(int,input().split())
l = sorted([int(i) for i in input().split()])
s = 0
for i in l:
    if i < x:
        s += i
    else:
        break
print(s)