n, x = map(int, input().split()) s = list(map(int, input().split())) sm = sum(s) a = [] for ss in s: a.append(x-ss) s = set(s) b = [] sa = sum(a) for aa in a: b.append(sa-aa) for bb in b: if bb*2 in s: print(bb) exit(0)