#include <cstdio>
#include <cassert>
#include <algorithm>
#include <vector>
#include <iostream>

using std::sort;
using std::vector;
using std::min;

typedef long long ll;
typedef std::pair<int,int> pii;

const int MAX = 100100;
int val[MAX];
int cnt[MAX];

inline int check(int a, int b, int K) {
  return a >= (b + K - 1) / K;
}

int main() {
  assert(freopen("game.in", "r", stdin));
  assert(freopen("game.out", "w", stdout));

  int n, K;
  scanf("%d%d", &n, &K);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &val[i]);
  }
  sort(val, val + n);
  int m = 0;
  for (int i = 0; i < n; ++i) {
    if (i == 0 || val[i] != val[i - 1]) {
      cnt[m] = 1;
      val[m] = val[i];
      m++;
    } else {
      cnt[m - 1] ++;
    }
  }
  long long ans = 0;
  for (int i = 0; i < m; ++i) {
    --cnt[i];
    for (int k = i; k < m; ++k) {
      if (!cnt[k]) { continue; }
      if (!check(val[i], val[k], K)) { break; }
      --cnt[k];
      for (int j = i; j <= k; ++j) {
        if (!cnt[j]) { continue; }
        int cnt = 0;
        if (i == j) { ++cnt; }
        if (j == k) { ++cnt; }
        ans += (cnt == 0 ? 6 : (cnt == 1 ? 3 : 1));
      }
      ++cnt[k];
    }
    ++cnt[i];
  }
  std::cout << ans << std::endl;

  return 0;
}
