#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
typedef long long LL;
const int N = 1 << 17;
LL a[N];

int main(){
    int n, m, x;
    while(scanf("%d%d",&n,&m)!=EOF) {
        for (int i = 1; i <= n; i++) {
            scanf("%d", &x);
            a[x]++;
        }
        for (int i = 0; i < N; i++) {
            a[i] = a[i] * 2;
        }
        for(int i = 1; i < N; i <<=1) {
            for(int j = 0; j < N; j +=(i<<1)) {
                for (int k = 0; k < i; k++) {
                    LL x0 = a[j + k];
                    LL x1 = a[i + j + k];
                    a[j + k] = x0 - x1;
                    a[i + j + k] = x0 + x1;
                }
            }
        }
        for (int i = 0; i < N; i++) {
            a[i] = a[i] * a[i];
        }
        for(int i = 1; i < N; i <<=1) {
            for(int j = 0; j < N; j +=(i<<1)) {
                for (int k = 0; k < i; k++) {
                    LL x0 = a[j + k];
                    LL x1 = a[i + j + k];
                    a[j + k] = (x0 + x1) / 2;
                    a[i + j + k] = (x1 - x0) / 2;
                }
            }
        }
        LL ans=0;
        for (int i = m + 1; i < N; i++) {
            ans +=a[i]/8;
        }
        printf("%lld\n", ans);
    }
    return 0;
}