package com.thinker.bishi.toutiao;

import java.util.Scanner;

/**
 * @author lzh
 */
public class Main2 {
    private void main(){
        Scanner in = new Scanner(System.in);
        int len = in.nextInt(),m = in.nextInt();
        int count = 0;
        int[] arr = new int[len];
        while(count < len){
            arr[count] = in.nextInt();
            count ++;
        }
        count = 0;
        for(int i=0;i<len-1;i++){
            for(int j=i+1;j<len;j++){
                if((arr[i] ^ arr[j]) > m) count ++;
            }
        }
        System.out.println(count);
    }
    public static void main(String[] args) {
        Main2 main2 = new Main2();
        main2.main();
    }
}
