#include <bits/stdc++.h>
using namespace std;
const long long UNDEF = -1;
const long long INF = 1e18;
template <typename T>
inline bool chkmax(T& aa, T bb) {
  return aa < bb ? aa = bb, true : false;
}
template <typename T>
inline bool chkmin(T& aa, T bb) {
  return aa > bb ? aa = bb, true : false;
}
static char stdinBuffer[1024];
static char* stdinDataEnd = stdinBuffer + sizeof(stdinBuffer);
static const char* stdinPos = stdinDataEnd;
void readAhead(size_t amount) {
  size_t remaining = stdinDataEnd - stdinPos;
  if (remaining < amount) {
    memmove(stdinBuffer, stdinPos, remaining);
    size_t sz = fread(stdinBuffer + remaining, 1,
                      sizeof(stdinBuffer) - remaining, stdin);
    stdinPos = stdinBuffer;
    stdinDataEnd = stdinBuffer + remaining + sz;
    if (stdinDataEnd != stdinBuffer + sizeof(stdinBuffer)) *stdinDataEnd = 0;
  }
}
int rint() {
  readAhead(16);
  int x = 0;
  bool neg = false;
  while (*stdinPos == ' ' || *stdinPos == '\n') ++stdinPos;
  if (*stdinPos == '-') {
    ++stdinPos;
    neg = true;
  }
  while (*stdinPos >= '0' && *stdinPos <= '9') {
    x *= 10;
    x += *stdinPos - '0';
    ++stdinPos;
  }
  return neg ? -x : x;
}
char rch() {
  readAhead(16);
  while (*stdinPos == ' ' || *stdinPos == '\n') ++stdinPos;
  char ans = *stdinPos;
  ++stdinPos;
  return ans;
}
long long rlong() {
  readAhead(32);
  long long x = 0;
  bool neg = false;
  while (*stdinPos == ' ' || *stdinPos == '\n') ++stdinPos;
  if (*stdinPos == '-') {
    ++stdinPos;
    neg = true;
  }
  while (*stdinPos >= '0' && *stdinPos <= '9') {
    x *= 10;
    x += *stdinPos - '0';
    ++stdinPos;
  }
  return neg ? -x : x;
}
int n;
long long k;
int a[104];
int f[104];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  n = rint();
  k = rlong();
  for (int i = 0; i < n; i++) a[i] = rint();
  sort(a, a + n);
  long long suma = 0;
  for (int i = 0; i < n; i++) suma += a[i];
  long long gota = (k + suma) / n;
  long long final = -1;
  if (gota >= a[n - 1]) final = gota;
  int slim = ceil(sqrt(a[n - 1]) * 4) + 1;
  while (slim * slim <= a[n - 1]) slim++;
  int s = slim;
  priority_queue<pair<int, int>, vector<pair<int, int> >,
                 greater<pair<int, int> > >
      pq;
  long long gsum = 0;
  int contrib = 0;
  for (int i = 0; i < n; i++) {
    f[i] = (a[i] + s - 1) / s;
    contrib += f[i];
    int rem = f[i] * s - a[i];
    gsum += rem;
    if (f[i] > 1) {
      int leeway = s + ((s - rem + f[i] - 2) / (f[i] - 1));
      pq.push(make_pair(leeway, i));
    }
  }
  while (!pq.empty()) {
    if (s > a[n - 1]) break;
    while (!pq.empty()) {
      auto got = pq.top();
      if (got.first > s) break;
      pq.pop();
      int i = got.second;
      int oldrem = f[i] * s - a[i];
      int oldf = f[i];
      f[i] = (a[i] + s - 1) / s;
      contrib += f[i] - oldf;
      int rem = f[i] * s - a[i];
      gsum += rem - oldrem;
      if (f[i] > 1) {
        int leeway = s + ((s - rem + f[i] - 2) / (f[i] - 1));
        pq.push(make_pair(leeway, i));
      }
    }
    if (pq.empty()) break;
    int ns = pq.top().first;
    int minleeway = ns - s;
    chkmax(minleeway, 0);
    int gomax = (k - gsum) / contrib;
    if (gomax >= 0) {
      int cango = min(gomax, minleeway);
      if (gsum + (cango * (long long)contrib) <= k)
        chkmax(final, (long long)(s + cango));
    }
    if (s == ns) break;
    int ds = ns - s;
    gsum += ds * (long long)contrib;
    s = ns;
  }
  for (int d = slim - 1; d >= 1; d--) {
    if (final >= d) {
      printf("%lld\n", final);
      return 0;
    }
    long long sum = 0;
    for (int i = 0; i < n; i++) {
      int rem = a[i] % d;
      if (rem > 0) sum += d - rem;
    }
    if (sum <= k) {
      printf("%d\n", d);
      return 0;
    }
  }
}
