#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, n, x, k, a[100009], d = 0;
  long long ans = 0;
  cin >> n >> k;
  for (i = 0; i < n; i++) {
    cin >> x;
    a[i] = x / k;
    if (x % k > 0) a[i]++;
  }
  for (i = 0; i < n; i++) {
    ans += a[i] / 2;
    if (a[i] % 2 == 1) d++;
  }
  ans += d / 2;
  if (d % 2 == 1) ans++;
  cout << ans << endl;
}
