using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static long[] NList => ReadLine().Split().Select(long.Parse).ToArray(); public static void Main() { Solve(); } static void Solve() { var c = NList; var (n, k) = (c[0], c[1]); var a = NList; var ans = 1L; for (var i = 0; i < n; ++i) { foreach (var p in PList(a[i])) { var sum = 0L; for (var j = 0; j < n; ++j) { sum += Math.Min(a[j] % p, p - a[j] % p); } if (sum <= k) ans = Math.Max(ans, p); } } WriteLine(ans); } static List PList(long n) { var ans = new List(); for (var i = 1L; i * i <= n; ++i) { if (n % i == 0) { ans.Add(i); if (i * i < n) ans.Add(n / i); } } return ans; } }