N, X = tuple(map(int, input().split()))
xs = list(sorted(map(int, input().split())))
print(N, X, xs)

def atGomi(k, x, energy, rest):
    print(k, x, energy, rest)
    if k == 0:
        if len(rest) == 0:
            return energy + 100 + (1+1) ** 2 * x + 100
        else:
            return atGomi(1, rest[-1], energy + 100 + (1+1) ** 2 * (x-rest[-1]), rest[:-1])
    if len(rest) == 0:
        # hirou
        e_hirou = energy + 100 + (k+1+1) ** 2 * x + 100
        e_hirowanai = energy + ((k+1) ** 2 * x) + 100 + 100 + (1+1) ** 2 * x + 100
        #e_hirowanai = atGomi(0, rest[-1], energy + k ** 2 + 100, rest[:len(rest)-1])
        return min(e_hirou, e_hirowanai)
    else:
        flist = list(filter(lambda i: i < x, rest))
        if len(flist) == 0:
            e_hirou = atGomi(0, rest[-1], energy + 100 + (k+1+1) ** 2 * x, rest[:-1])
            e_hirowanai = atGomi(0, rest[-1], energy + (k+1)**2 * x, sorted(rest[:-1]+[x]))
        else:
            next_x = max(flist)
            next_rest = list(filter(lambda i: i != next_x, rest))
            print(next_x, next_rest)
            exit(0)
            e_hirou = atGomi(k+1, next_x, energy + 100 + (k+1+1) ** 2 * (x-next_x), next_rest)
            e_hirowanai = atGomi(k, next_x, energy + (k+1)**2 * (x-next_x), sorted(next_rest+[x]))
            return min(e_hirou, e_hirowanai)

if N == 0 or len(xs) == 0:
    print(0)
else:
    xi = xs.pop()
    print(xi, xs)
    minGomi = atGomi(0, xi, 0, xs)
    print(minGomi)
