#include using namespace std; typedef long long ll; typedef pair P; #define REP(i,n) for(int i=0;i m; void div(ll n){ for(ll i=1;i*i<=n;i++){ if(n%i==0){ m[i]++; if(i!=n/i) m[n/i]++; } } } int main(void){ cin.tie(nullptr); ios_base::sync_with_stdio(false); ll i,j; ll N,K; cin >> N >> K; for(i=1;i<=N;i++){ cin >> a[i]; div(a[i]); } ll ans=1; for(auto c : m){ ll p=c.first,q=c.second; if(p==1) continue; if(N-K>q) continue; ll d=0; for(j=1;j<=N;j++){ d+=min(a[j]%p,p-a[j]%p); if(d>K) break; } if(d<=K) ans=max(ans,p); } cout << ans << endl; return 0; }