import sys input = sys.stdin.buffer.readline def _fourier(f, inverse = False): f = f[:] n = (len(f) - 1).bit_length() for d in range(n): for U in range(1 << n): if not U >> d & 1: s, t = f[U], f[U | 1 << d] f[U], f[U | 1 << d] = s + t, s - t if inverse: f = [v >> n for v in f] return f def convolution(f, g): return _fourier([a * b for a, b in zip(_fourier(f), _fourier(g))], inverse = 1) n, x = map(int, input().split()) A = list(map(int, input().split())) m = max(A).bit_length() f = [0] * (1 << m) for a in A: f[a] += 1 f2 = convolution(f, f) k = (sum(f2[:x]) - sum(f)) // 2 ans = 0 for d in range(m): f = [0] * (1 << m) for a in A: if not a >> d & 1: f[a] += 1 f2 = convolution(f, f) l = (sum(f2[:x]) - sum(f)) // 2 ans += (k - l) << d print(ans)