import java.util.*;


public class D {
    
    
    public static void main(String [] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        
        long u = 0;
        long res = 0;
        int ki = k;
        int days = 0;
        for (int i=0; i<n; i++) {
            long ai = sc.nextInt() + res;
            if (ai > ki) {
                if (ki == k)
                    u++;
                res = ai - ki;
                ki = k;
                days = 0;
                long b = res/k;
                res = res - k*b;
                u += b;
                if (res > 0) {
                    u++;
                    ki = (int)(ki - res);
                    res = 0;
                    days++;
                }
            } else if (ai < ki) {
                days++;
                if (ki == k)
                    u++;
                ki = (int)(ki - ai);
                res = 0;
            } else {
                if (ki == k)
                    u++;
                ki = k;
                res = 0;
                days = 0;
            }
            
            if (days == 2) {
                ki = k;
                res = 0;
            }
        }
        System.out.println(u);
    }
}
