#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  long long int x;
  long long int c, r;
  long long int S = 0;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    c = x / k;
    r = x % k;
    if (r != 0) {
      c++;
    }
    S += c;
  }
  long long int T = 0;
  T = S / 2;
  if (S % 2 == 1) T++;
  cout << T << '\n';
  return 0;
}
