#include <stdio.h>

int main(void) {
    int n, k, i, w, mx = 0;
    long sum = 0;
    scanf("%d %d", &n, &k);
    for (i = 0; i < n; i++) {
        scanf("%d", &w);
        if (w > mx) { mx = w; }
        sum += (long)w;
    }
    sum = (sum + (long)(k-1))/(long)k;
    if (sum > (long)mx) {
        printf("%d\n", (int)sum);
    } else {
        printf("%d\n", mx);
    }
    return 0;
}
