#緑以下Ex-B

#素因数分解 ライブラリ
class PrimeFact:
    def fact(self,N):  #Nを素因数分解し、(素因数, 次数) のリストを返す
        L=[]
        for i in range(2,N):
            if i**2>N: break
            if N%i==0:
                c=0
                while N%i==0: c+=1; N//=i
                L.append((i,c))
        return L if N==1 else L+[(N,1)]

    def div(self,N):  #Nの約数を全列挙する
        Low,High=[],[]
        for i in range(1,N+1):
            if i**2>N: break
            if N%i==0:
                Low.append(i)
                if i**2!=N: High.append(N//i)
        return Low+High[::-1]

    def euler(self,N):  #オイラーのファイ関数: X**(euler(M))≡1 mod M if gcd(X,M)=1
        L=self.fact(N); ans=N
        for p,_ in L: ans=ans*(p-1)//p
        return ans


import math

#入力受取
N,K = map(int,input().split())
A = list(map(int,input().split()))
PF = PrimeFact()
ans = 1

for first_ope in range(-K,K+1):
    G = A[0]+first_ope
    if G<=0: continue
    D = PF.div(G)
    nokori = K - abs(first_ope)

    #判定問題: 残りleft回の操作で、gcd(A) = X にできるか?
    for X in D:
        left = nokori
        for next in A[1:]:
            diff = next % X
            cnt = 10**18
            #減らす操作
            if next - diff > 0:
                cnt = min(cnt, diff)
            #増やす操作
            cnt = min(cnt, X-diff)
            left -= cnt
        if left>=0: ans = max(ans,X)
print(ans)