#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t, m, i, n, j, l = 0, r, x;
  int a[100011];
  cin >> n >> m;
  x = 0;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] % m == 0) {
      x = x + (a[i] / m);
    } else {
      x = x + 1 + (a[i] / m);
    }
  }
  if (x % 2)
    cout << (x + 1) / 2;
  else
    cout << x / 2;
  return 0;
}
