local n, x = io.read("*n", "*n")
local a = {}
for i = 1, n do
  a[i] = io.read("*n")
end
local inf = 1000000000
local cost = {}
for i = 1, n * n do
  cost[i] = 0
end
local mmi = math.min
for i = 1, n do
  for j = 0, n - 1 do
    local it = i + j
    if n < it then it = it - n end
    cost[j * n + it] = i
  end
end
for i = 1, n do
  for j = 0, n - 2 do
    local idx = j * n + i
    local pre_i = cost[idx]
    local pre_len = i - pre_i
    if pre_len < 0 then pre_len = pre_len + n end
    local pre_cost = a[pre_i] + x * pre_len
    local next_idx = idx + n
    local next_cost = a[cost[next_idx]] + x * (j + 1)
    if pre_cost < next_cost then
      cost[next_idx] = pre_i
    end
  end
end
local ret = 2000 * 1000000000
for j = 0, n - 1 do
  local sum = j * x
  for i = 1, n do
    sum = sum + a[cost[i + j * n]]
  end
  ret = mmi(ret, sum)
end
print(ret)
