题解 | #小易的升级之路#
小易的升级之路
https://www.nowcoder.com/practice/fe6c73cb899c4fe1bdd773f8d3b42c3d
def get_maxgys(a,b):
if a<b:
a,b=b,a
while b:
a, b = b, a%b
return a
while True:
try:
n,a=list(map(int,input().split()))
# lst=list(map(int,input().split()))
lst=[]
for i in range(n):
lst.append(int(input()))
nlz=a
for i in lst:
if i<=nlz:
nlz+=i
else:
nlz+=get_maxgys(nlz,i)
print(nlz)
except:
break

