#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()
template<class T>bool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool chmax(T&a, const T&b){if(a<b){a=b;return 1;}return 0;}

int main(){
    ll n, m, tot = 0, ans = 1LL<<60;
    cin >> n >> m;
    rep(i,n){
        ll a;
        cin >> a;
        tot += a;
        ans = min(ans, tot/(i+1)/m);
    }
    cout << ans << endl;
    return 0;
}