#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  int a[100009];
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  int t = 0;
  long long sum1 = 0;
  sort(a, a + n);
  int m = 0, l = 0, token = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (a[i] > k) {
      int temp = a[i] / k;
      token = temp;
      temp /= 2;
      if (a[i] % k != 0) {
        if (token % 2 == 1) temp++;
        token++;
      }
      if (token % 2 == 1) {
        if (l == 0)
          l = 1;
        else {
          t++;
          l = 0;
        }
      }
      t += temp;
    } else {
      if (m == 0) {
        m = 1;
      } else {
        t++;
        m = 0;
      }
    }
    if (l == 1 && m == 1 && i == 0)
      t++;
    else if (m == 1 && i == 0)
      t++;
    else if (l == 1 && i == 0)
      t++;
  }
  cout << t << "\n";
}
