package com.thinker.saima;

import java.util.Scanner;

public class ZhuangZaiChengKe{

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String[] tmp = sc.nextLine().split(" ");
		int n = Integer.parseInt(tmp[0]),m = Integer.parseInt(tmp[1]);
		tmp = sc.nextLine().split(" ");
		int[] arr = new int[tmp.length];
		//init 
		for(int i=0;i<arr.length;i++){
			arr[i] = Integer.parseInt(tmp[i]);
		}
		//count
		int count = 0,sum = 0;
		for(int i=0;i<arr.length;i++){
			if((sum + arr[i]) > m) {
				sum = arr[i];count ++;
			}else{
				sum += arr[i];
			}
		}
		count ++;
		System.out.println(count);

	}
}
