#!/usr/bin/env python3

def main():
  with open("game.in", "r") as fin:
    n, K = map(int, fin.readline().split())
    a = list(map(int, fin.readline().split()))
  a.sort()
  m = 0
  cnt = list()
  val = list()
  for i in range(n):
    if (i == 0) or (a[i] != a[i - 1]):
      m += 1
      cnt.append(1)
      val.append(a[i])
    else:
      cnt[m - 1] += 1

  ans = 0
  for i in range(m):
    if (cnt[i] >= 3):
      ans += 1
    temp = val[i] * K
    if (cnt[i] >= 2):
      cur = 3
    else:
      cur = 0
    for k in range(i + 1, m):
      if (temp < val[k]):
        break
      ans += cur
      cur += 6
      if (cnt[k] >= 2):
        ans += 3

  with open("game.out", "w") as fout:
    fout.write(str(ans) + "\n")


if __name__ == "__main__":
    main()

