import java.util.Scanner;
import java.util.Arrays;

public class Program {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        Integer n = scanner.nextInt();
        Integer capacity = scanner.nextInt();
        
        int array[] = new int[n];
        for (int i = 0; i < n; i++) {
               array[i] = scanner.nextInt();
        }
        
        long numBags = 0;
        int i = 0;
        
        while (i < n) {
            if ((i != 0) && array[i-1] != 0) {
                numBags++;
                if ((array[i] + array[i-1]) > capacity) {
                    array[i] = array[i] - (capacity - array[i-1]);
                    array[i-1] = 0;
                }
                else {
                    array[i] = array[i-1] = 0;
                }
            }
            if (array[i] >= capacity) {
                numBags += array[i]/capacity;
                array[i] = array[i] % capacity;
            }
            i++;
        }
        if (array[n-1] != 0) {
            numBags++;
        }
        
        System.out.println(numBags);
    }
}
	   	  			 		 	   		    			  		