#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int N = 1e6 + 5;
long long int POWER[65];
void precompute() {
  POWER[0] = 1;
  for (int i = 1; i < 63; i++) POWER[i] = POWER[i - 1] << 1LL;
}
int A[100001];
int main() {
  long long int k, n, cnt = 0;
  cin >> n >> k;
  for (long long int i = 0; i < n; i++) {
    cin >> A[i];
    cnt = cnt + A[i] / k;
    if (A[i] % k != 0) cnt++;
  }
  if (cnt % 2 == 0)
    cout << cnt / 2;
  else
    cout << (cnt / 2) + 1;
}
