def main():

    N, x = list(map(int, input().split()))

    a = list(map(int, input().split()))

    ans = float("INF")

    b = [float("INF")]*N

    for k in range(N):

        temp_ans = k*x

        for i in range(N):

            b[i] = min(b[i],a[i-k])

            temp_ans += b[i]

        ans = min(ans,temp_ans)

    print(ans)



if __name__ == "__main__":

    main()
def main():

    N, x = list(map(int, input().split()))

    a = list(map(int, input().split()))

    ans = float("INF")

    b = [float("INF")]*N

    for k in range(N):

        temp_ans = k*x

        for i in range(N):

            t = a[i-k]

            if t < b[i]:

                b[i] = t

            temp_ans += b[i]

        ans = min(ans,temp_ans)

    print(ans)



if __name__ == "__main__":

    main()
def main():
    N, x = list(map(int, input().split()))
    a = list(map(int, input().split()))
    ans = float("INF")
    b = [float("INF")] * N
    for k in range(N):
        temp_ans = k * x
        for i in range(N):
            b[i] = min(b[i], a[i - k])
            temp_ans += b[i]
        ans = min(ans, temp_ans)
    print(ans)


if __name__ == "__main__":
    main()

def main():
    N, x = list(map(int, input().split()))
    a = list(map(int, input().split()))
    ans = float("INF")
    b = [float("INF")] * N
    for k in range(N):
        temp_ans = k * x
        for i in range(N):
            t = a[i - k]
            if t < b[i]:
                b[i] = t
            temp_ans += b[i]
        ans = min(ans, temp_ans)
    print(ans)


if __name__ == "__main__":
    main()

-            b[i] = min(b[i], a[i - k]) +            t = a[i - k] +            if t < b[i]: +                b[i] = t