#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 = 100;
int a[MAX + 1];
bool use[MAX + 1][MAX + 1][MAX + 1];

int check(int a, int b, int K) {
  return a * K >= b && b * K >= a;
}

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

  int n, K;
  scanf("%d%d", &n, &K);
  int max = 0;
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    if (x > MAX) {
      assert (0);
    }
    if (max < x) {
      max = x;
    }
    a[x] ++;
  }
  int ans = 0;
  for (int i = 1; i <= max; ++i) {
    if (!a[i]) { continue; }
    --a[i];
    for (int j = 1; j <= max; ++j) {
      if (!a[j]) { continue; }
      --a[j];
      for (int k = 1; k <= max; ++k) {
        if (!a[k]) { continue; }
        --a[k];
        if (check(i, j, K) && check(i, k, K) && check(j, k, K)) {
          if (!use[i][j][k]) {
            ++ans;
            use[i][j][k] = 1;
          }
        }
        ++a[k];
      }
      ++a[j];
    }
    ++a[i];
  }
  printf("%d\n", ans);

  return 0;
}
