import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np from functools import partial fft_len = 1 << 18 fft = partial(np.fft.rfft, n=fft_len) ifft = partial(np.fft.irfft, n=fft_len) N,X,*A = map(int,read().split()) f = np.bincount(A) Ff = fft(f) g = np.rint(ifft(Ff ** 2)).astype(np.int64) answer = 0 if X >= len(g) else g[X] print(answer)