import sys

import copy

input = sys.stdin.readline



def main():

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

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



    min_ = copy.deepcopy(a)



    ans = int(1e15)

    # 魔法を唱える回数 k

    for k in range(N):

        tmp = k * x

        for i in range(N):

            min_[i] = min(min_[i], a[(i-k)%N])

            tmp += min_[i]

        # print(min_)

        ans = min(ans, tmp)

    print(ans)







if __name__ == "__main__":

    main()
import sys

import numpy as np

input = sys.stdin.readline



def main():

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

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



    min_ = np.array(a)



    ans = sum(min_)

    # 魔法を唱える回数 k

    for k in range(1, N):

        min_ = np.minimum(min_, np.roll(min_, 1))

        ans = min(ans, k * x + sum(min_))

    print(ans)







if __name__ == "__main__":

    main()
import sys
import copy

input = sys.stdin.readline


def main():
    N, x = list(map(int, input().split()))
    a = list(map(int, input().split()))
    min_ = copy.deepcopy(a)
    ans = int(1e15)
    # 魔法を唱える回数 k
    for k in range(N):
        tmp = k * x
        for i in range(N):
            min_[i] = min(min_[i], a[(i - k) % N])
            tmp += min_[i]
        # print(min_)
        ans = min(ans, tmp)
    print(ans)


if __name__ == "__main__":
    main()

import sys
import numpy as np

input = sys.stdin.readline


def main():
    N, x = list(map(int, input().split()))
    a = list(map(int, input().split()))
    min_ = np.array(a)
    ans = sum(min_)
    # 魔法を唱える回数 k
    for k in range(1, N):
        min_ = np.minimum(min_, np.roll(min_, 1))
        ans = min(ans, k * x + sum(min_))
    print(ans)


if __name__ == "__main__":
    main()

-import copy +import numpy as np -    min_ = copy.deepcopy(a) -    ans = int(1e15) +    min_ = np.array(a) +    ans = sum(min_) -    for k in range(N): -        tmp = k * x -        for i in range(N): -            min_[i] = min(min_[i], a[(i - k) % N]) -            tmp += min_[i] -        # print(min_) -        ans = min(ans, tmp) +    for k in range(1, N): +        min_ = np.minimum(min_, np.roll(min_, 1)) +        ans = min(ans, k * x + sum(min_))