#include <cstdio> using namespace std; int N, K, V[100005]; inline bool Ckd(long long T) { int Sc = 0; long long C = T; for (int i = 1; i <= N; i ++, C += T) { if (C <= V[i]) C = 0; else ++ Sc, C = C - V[i]; } return Sc + Sc > N; } int main() { scanf("%d%d", &N, &K); for (int i = 1; i <= N; i ++) scanf("%d", V + i); int L = 1, R = K + 1, M; while (L < R - 1) { M = (L + R) >> 1; Ckd(M) ? R = M : L = M; } printf("%d\n", R); return 0; }
10
24
2015
24
2015