#include <windows.h>
#include <bits/stdc++.h>
using namespace std;
# define fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl "\n"
#define all(v) v.begin(),v.end()
#define mod 1000000007 ;
#define Mod 998244353 ;
#define yes "YES";
#define na "NO";
typedef long long ll;

void IO()
{
#ifndef ONLINE_JUDGE
	freopen("pracin.txt", "r", stdin);
	freopen("pracout.txt", "w", stdout);
	freopen("error.txt", "w", stderr);
#endif
	fast;
}
vector<bool> used(200000);
vector<int> adj[200000];
vector<int> dir[200005];
vector<int> a, b;
void bfs(int i)
{
	queue<int> q;
	q.push(i);
	used[i] = 1;
	a.push_back(i);
	while (!q.empty())
	{	i = q.front();
		q.pop();
		for (auto vertex : adj[i])
		{
			if (used[vertex] == -1)
			{
				used[vertex] = used[i] ^ 1;
				if (used[vertex] == 1) a.push_back(vertex);
				else b.push_back(vertex);
				q.push(vertex);
			}
			if (used[vertex] == used[i]) {
				cout << -1;
				exit(0);
			}

		}


	}
}
// binnary exponention (logn)
ll ans(ll a, ll b) {
	if (b == 0)
		return 1;
	ll res = ans(a, b / 2);
	if (b % 2)
		return res * res * a % Mod;

	return res * res % Mod;
}
void solve()
{

	ll ans = 0;
	ll n, k; cin >> n >> k;
	ll a[n];

	for (int i = 0; i < n; i++)
		cin >> a[i];
	bool prev = true;
	for (int i = 0; i < n; i++)
	{
		if (i == n - 1)
		{
			ans += a[i] / k + (a[i] % k != 0);
			break;
		}
		if (a[i] == 0 )continue;
		if (a[i] <= k)
		{
			a[i + 1] = max(0ll, a[i + 1] + a[i] - k);
			ans++;
			continue;
		}

		ans += a[i] / k;
		a[i] = a[i] - (a[i] / k) * k;
		ans++;
		a[i + 1] = max(0ll, a[i + 1] + a[i] - k );


	}
	cout << ans;
}
int main()
{
	IO();

	// int t; cin >> t; while (t--)
	solve();

	// cout << 2 * 3;

	// remember the question's fine details
	// edges cases will fuck u
	// always check for edges cases
	//  n == 1, n = size - 1, n is prime ,we

	return 0;
}



