import java.util.*;
import java.lang.Math;


public class DD {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        
        long u = 0;
        long trash = 0;
        int days = 0;
        int kheb = 0;
        for (int i = 0; i<n; i++) {
            trash += sc.nextInt();
            while (trash > 0) {
                if (kheb == 0)
                    days = 0;
                if (kheb != 0) {
                    if (trash >= kheb) {
                        trash = trash - kheb;
                        kheb = 0;
                    } else {
                        trash = 0;
                        kheb -= trash;
                    }
                } else {
                    long b = (long)Math.ceil((double)trash/k);
                    kheb = (int)(b*k - trash); 
                    trash = 0;
                    u += b;
                }
            }
            if (kheb > 0)
                days++;
            if (kheb == 0)
                days = 0;
            if (days == 2) {
                kheb = 0;
            }
        }
        System.out.println(u);
    }
}
