import itertools N, M = map(int,input().split()) Set_N = [int(input()) for _ in range(N)] subset = [] set_2 = [] not_candidates = [] set_length = [] if len(Set_N) == 1: print(1) else: for i in range(1,N+1): for j in itertools.combinations(Set_N,i): subset.append(list(j)) for i in subset: if len(i) == 1: pass else: for pair in itertools.combinations(i,2): for k in range(1,len(Set_N)+1): if M >= sum(pair): if M % sum(pair) != 0: set_2.append(i) elif M < sum(pair): if sum(pair) % M != 0: set_2.append(i) if len(i) == k and (M % sum(pair) == 0 or sum(pair) % M == 0): not_candidates.append(i) for i in set_2: if i not in not_candidates: set_length.append(len(i)) print(max(set_length))