Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import copy

N, x = map(int,raw_input().split())
A = map(int,raw_input().split())

B = copy.deepcopy(np.array(A))
m = sum(B)
for idx in xrange(1,N):
  A.append(A[0])
  A.pop(0)
  np.fmin(B, A, out=B)
  m = min(sum(B)+idx*x, m)

print int(m)

Fixed submission:
import time
import numpy as np
import copy

tflag = False
if tflag:
  N = 2000
  m = 1000000000
  x = np.random.randint(m)
  A = list(np.random.randint(m,size=(N)))
  st = time.time()
else:
  N, x = map(int,raw_input().split())
  A = map(int,raw_input().split())

#B = copy.deepcopy(A)
B = A
A = A + A
m = sum(B)
for idx in xrange(1,N):
  for jdx in xrange(N):
    if B[jdx] > A[jdx+N-idx]:
      B[jdx] = A[jdx+N-idx]
#  A = np.append(A, A[0])
#  A = np.delete(A, 0)
#  B = np.fmin(B,A)
  m = min(sum(B)+idx*x, m)

print int(m)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import copy

N, x = map(int,raw_input().split())
A = map(int,raw_input().split())

B = copy.deepcopy(A)
m = sum(B)
for idx in xrange(1,N):
  A = np.append(A, A[0])
  A = np.delete(A, 0)
  B = np.fmin(B,A)
  m = min(sum(B)+idx*x, m)

print int(m)

Fixed submission:
import time
import numpy as np
import copy

tflag = False
if tflag:
  N = 2000
  m = 1000000000
  x = np.random.randint(m)
  A = list(np.random.randint(m,size=(N)))
  st = time.time()
else:
  N, x = map(int,raw_input().split())
  A = map(int,raw_input().split())

#B = copy.deepcopy(A)
B = A
A = A + A
m = sum(B)
for idx in xrange(1,N):
  for jdx in xrange(N):
    if B[jdx] > A[jdx+N-idx]:
      B[jdx] = A[jdx+N-idx]
#  A = np.append(A, A[0])
#  A = np.delete(A, 0)
#  B = np.fmin(B,A)
  m = min(sum(B)+idx*x, m)

print int(m)

Buggy python submission (verdict: Time Limit Exceeded):
import time
import numpy as np
import copy

tflag = False
if tflag:
  N = 2000
  m = 1000000000
  x = np.random.randint(m)
  A = np.random.randint(m,size=(N))
  st = time.time()
else:
  a = map(int,raw_input().split())
  N = a[0]
  x = a[1]
  A = map(int,raw_input().split())

B = copy.deepcopy(A)
m = sum(B)
for idx in xrange(1,N):
  A = np.append(A, A[0])
  A = np.delete(A, 0)
  B = np.fmin(B,A)
  m = min(sum(B)+idx*x, m)

print int(m)

Fixed submission:
import time
import numpy as np
import copy

tflag = False
if tflag:
  N = 2000
  m = 1000000000
  x = np.random.randint(m)
  A = list(np.random.randint(m,size=(N)))
  st = time.time()
else:
  N, x = map(int,raw_input().split())
  A = map(int,raw_input().split())

#B = copy.deepcopy(A)
B = A
A = A + A
m = sum(B)
for idx in xrange(1,N):
  for jdx in xrange(N):
    if B[jdx] > A[jdx+N-idx]:
      B[jdx] = A[jdx+N-idx]
#  A = np.append(A, A[0])
#  A = np.delete(A, 0)
#  B = np.fmin(B,A)
  m = min(sum(B)+idx*x, m)

print int(m)

Buggy python submission (verdict: Time Limit Exceeded):
import time
import numpy as np
import copy

tflag = True
if tflag:
  N = 2000
  m = 1000000000
  x = np.random.randint(m)
  A = np.random.randint(m,size=(N))
  st = time.time()
else:
  a = map(int,raw_input().split())
  N = a[0]
  x = a[1]
  A = map(int,raw_input().split())

B = copy.deepcopy(A)
m = sum(B)
for idx in xrange(1,N):
  A = np.append(A, A[0])
  A = np.delete(A, 0)
  B = np.fmin(B,A)
  m = min(sum(B)+idx*x, m)

print int(m)

Fixed submission:
import time
import numpy as np
import copy

tflag = False
if tflag:
  N = 2000
  m = 1000000000
  x = np.random.randint(m)
  A = list(np.random.randint(m,size=(N)))
  st = time.time()
else:
  N, x = map(int,raw_input().split())
  A = map(int,raw_input().split())

#B = copy.deepcopy(A)
B = A
A = A + A
m = sum(B)
for idx in xrange(1,N):
  for jdx in xrange(N):
    if B[jdx] > A[jdx+N-idx]:
      B[jdx] = A[jdx+N-idx]
#  A = np.append(A, A[0])
#  A = np.delete(A, 0)
#  B = np.fmin(B,A)
  m = min(sum(B)+idx*x, m)

print int(m)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
a = map(int,raw_input().split())
N = a[0]
x = a[1]
A = map(int,raw_input().split())

B = [A]
m = sum(B[0])
for idx in xrange(1,N):
  B.append( [min(B[idx-1][i], A[i-idx]) for i in range(N)] )
  m = min(m, sum(B[idx])+idx*x)
 
print int(m)

Fixed submission:
import time
import numpy as np
import copy

tflag = False
if tflag:
  N = 2000
  m = 1000000000
  x = np.random.randint(m)
  A = list(np.random.randint(m,size=(N)))
  st = time.time()
else:
  N, x = map(int,raw_input().split())
  A = map(int,raw_input().split())

#B = copy.deepcopy(A)
B = A
A = A + A
m = sum(B)
for idx in xrange(1,N):
  for jdx in xrange(N):
    if B[jdx] > A[jdx+N-idx]:
      B[jdx] = A[jdx+N-idx]
#  A = np.append(A, A[0])
#  A = np.delete(A, 0)
#  B = np.fmin(B,A)
  m = min(sum(B)+idx*x, m)

print int(m)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np


tflag = False
if tflag:
  N = 2000
  m = 1000000000
  x = np.random.randint(m)
  A = np.random.randint(m,size=(N))
#  st = time.time()
else:
  a = map(int,raw_input().split())
  N = a[0]
  x = a[1]
  A = map(int,raw_input().split())

E = np.zeros(N)
B = [A]
E[0] = sum(B[0])
for idx in xrange(1,N):
  B.append( [min(B[idx-1][i], A[i-idx]) for i in range(N)] )
  E[idx] = sum(B[idx])+idx*x

print int(min(E))

Fixed submission:
import time
import numpy as np
import copy

tflag = False
if tflag:
  N = 2000
  m = 1000000000
  x = np.random.randint(m)
  A = list(np.random.randint(m,size=(N)))
  st = time.time()
else:
  N, x = map(int,raw_input().split())
  A = map(int,raw_input().split())

#B = copy.deepcopy(A)
B = A
A = A + A
m = sum(B)
for idx in xrange(1,N):
  for jdx in xrange(N):
    if B[jdx] > A[jdx+N-idx]:
      B[jdx] = A[jdx+N-idx]
#  A = np.append(A, A[0])
#  A = np.delete(A, 0)
#  B = np.fmin(B,A)
  m = min(sum(B)+idx*x, m)

print int(m)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np


tflag = False
if tflag:
  N = 2000
  m = 1000000000
  x = np.random.randint(m)
  A = np.random.randint(m,size=(N))
#  st = time.time()
else:
  a = map(int,raw_input().split())
  N = a[0]
  x = a[1]
  A = map(int,raw_input().split())

E = np.zeros(N)
B = 1000000000*np.ones((N,N))
B[0] = np.array(A)
E[0] = sum(B[0])
for idx in xrange(1,N):
  B[idx] = np.array([min(B[idx-1][i], A[i-idx]) for i in range(N)])
  E[idx] = sum(B[idx])+idx*x

print int(min(E))

Fixed submission:
import time
import numpy as np
import copy

tflag = False
if tflag:
  N = 2000
  m = 1000000000
  x = np.random.randint(m)
  A = list(np.random.randint(m,size=(N)))
  st = time.time()
else:
  N, x = map(int,raw_input().split())
  A = map(int,raw_input().split())

#B = copy.deepcopy(A)
B = A
A = A + A
m = sum(B)
for idx in xrange(1,N):
  for jdx in xrange(N):
    if B[jdx] > A[jdx+N-idx]:
      B[jdx] = A[jdx+N-idx]
#  A = np.append(A, A[0])
#  A = np.delete(A, 0)
#  B = np.fmin(B,A)
  m = min(sum(B)+idx*x, m)

print int(m)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np


tflag = False
if tflag:
  N = 2000
  m = 1000000000
  x = np.random.randint(m)
  A = np.random.randint(m,size=(N))
#  st = time.time()
else:
  a = map(int,raw_input().split())
  N = a[0]
  x = a[1]
  A = map(int,raw_input().split())

E = np.zeros(N)
B = 1000000000*np.ones((N,N))
B[0] = np.array(A)
E[0] = sum(B[0])
for idx in xrange(1,N):
  B[idx] = np.array([min(B[idx-1][i], A[i-idx]) for i in range(N)])
  E[idx] = sum(B[idx])+idx*x

print int(min(E))

Fixed submission:
import time
import numpy as np
import copy

tflag = False
if tflag:
  N = 2000
  m = 1000000000
  x = np.random.randint(m)
  A = list(np.random.randint(m,size=(N)))
  st = time.time()
else:
  N, x = map(int,raw_input().split())
  A = map(int,raw_input().split())

#B = copy.deepcopy(A)
B = A
A = A + A
m = sum(B)
for idx in xrange(1,N):
  for jdx in xrange(N):
    if B[jdx] > A[jdx+N-idx]:
      B[jdx] = A[jdx+N-idx]
#  A = np.append(A, A[0])
#  A = np.delete(A, 0)
#  B = np.fmin(B,A)
  m = min(sum(B)+idx*x, m)

print int(m)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

a = map(int,raw_input().split())
N = a[0]
x = a[1]
A = map(int,raw_input().split())

B = np.zeros(N)
E = np.zeros(N)
D = np.zeros((N,N))
F = np.zeros((N,N))
C = 10000000000*np.ones((N,N))
for idx in xrange(N):
  C[idx] = np.array([A[idx-i]+x*i for i in xrange(N)])
  D[idx] = np.array([A[idx-i] for i in xrange(N)])
  F[idx] = np.array(range(N))
  B[idx] = D[idx][np.where(C[idx]==min(C[idx]))[0][0]]
  E[idx] = F[idx][np.where(C[idx]==min(C[idx]))[0][0]]

print int(sum(B)+max(E)*x)

Fixed submission:
import time
import numpy as np
import copy

tflag = False
if tflag:
  N = 2000
  m = 1000000000
  x = np.random.randint(m)
  A = list(np.random.randint(m,size=(N)))
  st = time.time()
else:
  N, x = map(int,raw_input().split())
  A = map(int,raw_input().split())

#B = copy.deepcopy(A)
B = A
A = A + A
m = sum(B)
for idx in xrange(1,N):
  for jdx in xrange(N):
    if B[jdx] > A[jdx+N-idx]:
      B[jdx] = A[jdx+N-idx]
#  A = np.append(A, A[0])
#  A = np.delete(A, 0)
#  B = np.fmin(B,A)
  m = min(sum(B)+idx*x, m)

print int(m)