#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long int n, k, sum = 0;
  long long int arr[100000];
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    if (arr[i] % k == 0)
      arr[i] = arr[i] / k;
    else
      arr[i] = arr[i] / k + 1;
    sum += arr[i];
  }
  if (sum % 2 == 0)
    cout << sum / 2;
  else
    cout << sum / 2 + 1;
  return 0;
}
