import java.util.*;

public class dispose
{
	public static void main(String[] args)
	{
		Scanner s = new Scanner(System.in);
		StringTokenizer st = new StringTokenizer(s.nextLine());
		long n = Integer.parseInt(st.nextToken());
		long k = Integer.parseInt(st.nextToken());
		
		StringTokenizer st2 = new StringTokenizer(s.nextLine());
		ArrayList<Integer> amt = new ArrayList<Integer>();
		int totalGarbage = 0;
		long bags = 0;
		for (int i = 0; i < n; i++)
		{
			amt.add(Integer.parseInt(st2.nextToken()));
		}
		for (int i = 0; i < n; i++)
		{
			totalGarbage += amt.get(i);
			if (i > 0)
			{
				if (totalGarbage >= k)
				{
					bags += (long) Math.floorDiv(totalGarbage, k);
					long sub = Math.floorDiv(totalGarbage, k) * k;
					totalGarbage %= k;
					for (int j = i - 1; j <= i; j++)
					{
						if (sub - amt.get(j) >= 0)
						{
							sub -= amt.get(j);
							amt.set(j, 0);
						}
						else
						{
							amt.set(j, (int) (amt.get(j) - sub));
							sub = 0;
						}
					}
				}
				else
				{
					if (totalGarbage != 0)
					{
						if (amt.get(i-1) > 0)
						{
							totalGarbage = 0;
							bags++;
							amt.set(i-1, 0);
							amt.set(i, 0);
						}
					}
				}
			}
			if (n == 1)
			{
				bags += Math.floorDiv(totalGarbage, k);
				totalGarbage -= Math.floorDiv(totalGarbage, k) * k;
			}
		}
		if (totalGarbage > 0)
		{
			bags++;
		}
		System.out.print(bags);
		s.close();
	}
}