CodeEff/ECCO huggingface dataset:
# Original solution
N, C, K = list(map(int, input().split()))

T = [int(eval(input())) for _ in range(N)]

T.sort()

num_track = 0
i = 0
while i < N:
	L = T[i]
	if i + C + 1 < N:
		kouho = T[i:i+C] # T[i],...,T[i+C-1]
	else:
		kouho = T[i:]
	# <= L + K
	num = 0
	for j in range(len(kouho)):
		if kouho[j] - L <= K:
			num += 1
	num_track += 1
	i += num

print(num_track)



# Optimized solution
N, C, K = list(map(int, input().split()))

T = [int(eval(input())) for _ in range(N)]

T.sort()

res = 0
i = 0
while i < N:
	res += 1
	Left = i
	while (i < N and T[i] - T[Left] <= K and i - Left + 1 <= C):
		i += 1

print(res)
# Original solution
from collections import deque

n,c,k = list(map(int, input().split()))
t = [int(eval(input())) for _ in range(n)]

tk = [(ti, ti+k) for ti in t]
tk.sort(key=lambda x:x[1])
tk = deque(tk)
#print(tk)


ans = 0
# tkが尽きるまで
while tk:
    _, bus = tk[0]
    
    # バスの時刻より早く来ている客をカウント
    cnt = 0
    while (tk[cnt][0] <= bus) and (cnt < c):
        cnt += 1
        
        if cnt == len(tk):
            break
        
        
    # バスの定員もしくはいる人数を乗せていく
    for _ in range(min(cnt,c)):
        tk.popleft()
    
    ans += 1
        
print(ans)

# Optimized solution
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n,c,k = li()
t = [ni() for _ in range(n)]

t.sort()

ans = 0
people = 0
isfirst = True
for ti in t:
    if isfirst:
        first = ti
        people = 1
        isfirst = False
        
    else:
        if ti <= first + k and people < c:
            people += 1
            
        else:
            ans += 1
            
            people = 1
            first = ti

print((ans+1))
# Original solution
from bisect import bisect_right
N,C,K = list(map(int,input().split()))
T = sorted([int(eval(input())) for _ in range(N)])
cnt = 0
cur = 0
while cur<N:
    i = min(cur+C,N)-1
    if T[i]-T[cur]<=K:
        cnt += 1
        cur = i+1
    else:
        i = bisect_right(T,T[cur]+K)-1
        cnt += 1
        cur = i+1
print(cnt)

# Optimized solution
from bisect import bisect_right
N,C,K = list(map(int,input().split()))
T = sorted([int(eval(input())) for _ in range(N)])
cur = 0
cnt = 0
while cur<N:
    ind = bisect_right(T,T[cur]+K)
    if ind-cur<=C:
        cnt += 1
        cur = ind
    else:
        cnt += 1
        cur += C
print(cnt)
# Original solution
def solve():
  N, C, K = list(map(int, input().split()))
  T = [int(eval(input())) for _ in range(N)]
  T.sort()
  cnt = 0
  ans = 1
  for i in range(N-1):
    if i==0:
      t = T[0]
    cnt += 1
    if T[i+1]>t+K or cnt>=C:
      ans += 1
      cnt = 0
      t = T[i+1]
  return ans
print((solve()))

# Optimized solution
def solve():
  N, C, K = list(map(int, input().split()))
  ans = 1
  cnt = 0
  T = [int(eval(input())) for _ in range(N)]
  T.sort()
  for i in range(N):
    if i==0:
      now = T[i]
    cnt += 1
    if now+K<T[i] or cnt>C:
      ans += 1
      cnt = 1
      if i<N-1:
        now = T[i]
  return ans
print((solve()))
# Original solution
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, c, k = list(map(int, readline().split()))
t = sorted([int(readline()) for i in range(n)])
cnt = 0
ans = 1
time = t[0] + k
for i in range(n):
    if cnt >= c or time < t[i]:
        ans += 1
        cnt = 0
        time = t[i] + k
    cnt += 1
print(ans)


# Optimized solution
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, c, k = list(map(int, readline().split()))
t = [int(readline()) for _ in range(n)]
t.sort()
ans = 1
tmp = [t[0], 0]
for tt in t:
    if tmp[0] + k < tt or tmp[1] + 1 > c:
        ans += 1
        tmp = [tt, 0]
    tmp[1] += 1
print(ans)
# Original solution
N,C,K = list(map(int,input().split()))
T = [int(eval(input())) for i in range(N)]

ans = 0
capa = 0
dept = -1
for t in sorted(T):
    if t > dept or capa == 0:
        ans += 1
        dept = t+K
        capa = C-1
    else:
        capa -= 1
print(ans)

# Optimized solution
N,C,K = list(map(int,input().split()))
T = [int(eval(input())) for i in range(N)]
T.sort()

cap = C-1
dep = T[0] + K
ans = 1
for t in T[1:]:
    if cap and t <= dep:
        cap -= 1
    else:
        cap = C-1
        dep = t + K
        ans += 1
print(ans)
# Original solution
N, C, K = list(map(int, input().split()))
Tlist = sorted([int(eval(input())) for _ in range(N)])
ans = 0
count = 0

for i in range(N):
    now = Tlist[i]
    if count == 0:
        rl = now + K
        count += 1
        continue
    else:
        if now <= rl <= now + K and count < C:
            count += 1
        else:
            ans += 1
            rl = now + K
            count = 1
print((ans + 1))


# Optimized solution
N, C, K = list(map(int, input().split()))
Tlist = sorted([int(eval(input())) for _ in range(N)])
ans = 0
now = 1
start = Tlist[0]
for t in Tlist[1:]:
    if now == C:
        ans += 1
        start = t
        now = 1
    else:
        if t - start <= K:
            now += 1
        else:
            ans += 1
            start = t
            now = 1
print((ans+1))
# Original solution
n,c,k=list(map(int,input().split()))
t=[int(eval(input())) for x in range(n)]
t.sort()

i=0
cnt=0
while i<n:
  departure=t[i]+k
  p=0
  for j in range(i,n):
    if t[j] > departure or p==c:
      break
    p+=1
  i+=p
  cnt+=1
print(cnt)

# Optimized solution
import sys
n,c,k,*t = list(map(int, sys.stdin.read().split()))
t.sort()

i=0
cnt=0
while i<n:
  departure=t[i]+k
  p=0
  for j in range(i,n):
    if t[j] > departure or p==c:
      break
    p+=1
  i+=p
  cnt+=1
print(cnt)
# Original solution
n, c, k = list(map(int, input().split()))
t = sorted([int(eval(input())) for _ in range(n)])

bus = []
ans = 0

while len(t) != 0:
	temp = t.pop(0)
	if len(bus) == 0:
		bus.append(temp)
	else:
		if temp < bus[0] + k:
			bus.append(temp)
			if len(bus) == c:
				ans += 1
				bus = []
		else:
			ans += 1
			bus = []

print((ans+1))

# Optimized solution
n, c, k = list(map(int,input().split()))
t = sorted([int(eval(input())) for _ in range(n)])

ans = 0
bus = []

for i in range(n):
	if len(bus) == c:
		ans += 1
		bus = [t[i]]
	elif bus != [] and bus[0] + k < t[i]:
		ans += 1
		bus = [t[i]]
	else:
		bus.append(t[i])

print((ans+1))
# Original solution
import sys
input = sys.stdin.readline

n, c, k = [int(w) for w in input().split()]
la = [int(eval(input())) for _ in range(n)]
la.sort()
lak = [a + k for a in la]

ind = 0
ans = 0
while ind < n:
    ride = 0
    for i in range(min(c, n - ind)):
        if la[ind + i] <= lak[ind]:
            ride += 1
    ind += ride
    ans += 1

print(ans)


# Optimized solution
import sys
import bisect
input = sys.stdin.readline

n, c, k = [int(w) for w in input().split()]
la = [int(eval(input())) for _ in range(n)]
la.sort()
lak = [a + k for a in la]

ind = 0
ans = 0
while ind < n:
    ride = bisect.bisect_right(la, lak[ind]) - ind
    ind += min(ride, c)
    ans += 1

print(ans)
# Original solution
N, C, K = list(map(int, input().split()))
T = [int(eval(input())) for i in range(N)]
T.sort()
count = 0
ans = 0
start = 0
for i in range(N):
    if count < C:
        if count == 0:
            count += 1
            start = T[i]
        else:
            if T[i] <= start + K:
                count += 1
            else:
                ans += 1
                count = 1
                start = T[i]
    else:
        count = 1
        ans += 1
        start = T[i]

    if i == N - 1:
        ans += 1
print(ans)


# Optimized solution
N, C, K = list(map(int, input().split()))
T = [int(eval(input())) for i in range(N)]
T.sort()
prev = -1
r = 0
ans = 0
for t in T:
    if prev > 0 and t - prev > K:
        prev = t
        r = 1
        ans += 1
    elif prev < 0:
        prev = t
        ans += 1
        r = 1
    else:
        r += 1

    if r == C:
        prev = -1
        r = 0


print(ans)
# Original solution
N, C, K = [int(_) for _ in input().split()]
times = sorted([int(eval(input())) for _ in range(N)])
count = 0
while times:
    t = times.pop(0)
    count += 1
    num = 1
    while times:
        if times[0] <= t + K and num < C:
            times.pop(0)
            num += 1
        else:
            break
print(count)


# Optimized solution
N, C, K = [int(_) for _ in input().split()]
times = sorted([int(eval(input())) for _ in range(N)], reverse=True)
count = 0
while times:
    t = times.pop()
    count += 1
    num = 1
    while times:
        if times[-1] <= t + K and num < C:
            times.pop()
            num += 1
        else:
            break
print(count)
# Original solution
N, C, K = list(map(int,input().split()))
T = [int(eval(input())) for i in range(N)]
T.sort()
counter = 0
i = 0
while i<N:
    for j in range(C):
        if i+(C-j-1)<N and T[i]+K >= T[i+(C-j-1)]:
            counter += 1
            i = i+(C-j-1)+1
            break
print(counter)



# Optimized solution
N, C, K = list(map(int,input().split()))
T = [int(eval(input())) for i in range(N)]
T.sort(reverse = True)
counter = 1
i = 0           #### whileの中のカウント（バス乗車数）
A = T.pop()     #####先頭
while T:
  a = T.pop()
  i+=1
  if i>=C or a>A+K:
    i=0
    A=a
    counter += 1
  
print(counter)
# Original solution
def resolve():
    N, C, K = list(map(int, input().split()))
    T = [int(eval(input())) for _ in range(N)]
    T.sort()
    count_bus = 0
    L = len(T)

    i = 0
    while i < L:
        # print('T[{}]: {}'.format(i, T[i]))
        t = T[i]
        for j in range(1, C):
            if i+j >= L:
                i += j
                count_bus += 1
                break

            if T[i+j] <= t + K:
                pass
                if j == C-1:
                    i += j + 1
                    count_bus += 1
                    break

            else:
                count_bus += 1
                i += j
                break

    print(count_bus)


if __name__ == '__main__':
    resolve()

# Optimized solution
N, C, K = list(map(int, input().split()))
T = [int(eval(input())) for _ in range(N)]
T.sort()

# print(T)

bus = 1
org = T[0]
_count = 0

for t in T:

    if t - org <= K and _count < C:
        _count += 1
        # print('1- t:{}, org:{}, _count:{}, bus:{}'.format(t, org, _count, bus))
    else:
        bus += 1
        org = t
        _count = 1
        # print('2- t:{}, org:{}, _count:{}, bus:{}'.format(t, org, _count, bus))

print(bus)
# Original solution
# https://atcoder.jp/contests/agc011/tasks/agc011_a

n, c, k = list(map(int, input().split()))

schedule = []
for _ in range(n):
    t = int(eval(input()))
    schedule.append(t)
schedule.sort()
# schedule.append(float('inf'))

def check(num, schedule, c, k):
    bus = 0
    start = schedule[0]
    p = 0
    i = 0
    while i < len(schedule):
        s = schedule[i]
        if s <= start + k:
            p += 1
            i += 1
            if p == c:
                bus += 1
                p = 0
                if i == len(schedule):
                    break
                start = schedule[i]
        else:
            start = schedule[i]
            bus += 1
            p = 1
            i += 1
    if p:
        bus += 1
    if bus <= num:
        return True
    return False

l = 0
r = 10 ** 10
ans = float('inf')
while l <= r:
    mid = (l + r) // 2
    if check(mid, schedule, c, k):
        r = mid - 1
        ans = min(ans, mid)
    else:
        l = mid + 1

print(ans)


# Optimized solution
# https://atcoder.jp/contests/agc011/tasks/agc011_a

n, c, k = list(map(int, input().split()))

schedule = []
for _ in range(n):
    t = int(eval(input()))
    schedule.append(t)
schedule.sort()

ans = 0
start = schedule[0]
p = 0
for i in range(n):
    s = schedule[i]
    if s <= start + k:
        p += 1
        if p == c:
            ans += 1
            p = 0
            if i + 1 == n:
                break
            start = schedule[i + 1]
    else:
        ans += 1
        start = schedule[i]
        p = 1
if p:
    ans += 1
print(ans)
# Original solution
import sys
from bisect import bisect_right
input = sys.stdin.readline

N, C, K = list(map(int, input().split()))
T = [int(eval(input())) for i in range(N)]
T.sort()
answer = 0

while T:
    n = min(C - 1, len(T) - 1)
    if T[n] <= T[0] + K:
        n = C
    else:
        n = bisect_right(T, T[0] + K)
    T = T[n:]
    answer += 1

print(answer)

# Optimized solution
import sys
input = sys.stdin.readline

N, C, K = list(map(int, input().split()))
T = [int(eval(input())) for i in range(N)]
T.sort()
answer = 1
limit = T[0] + K
n = 0

for i in T:
    if i <= limit and n < C:
        n += 1
    else:
        answer += 1
        n = 1
        limit = i + K

print(answer)
# Original solution
N,C,K = list(map(int,input().split()))
T = [int(eval(input())) for i in range(N)]

T.sort()
i = 0
ans = 0

while i < N:
    t = T[i]
    x = T.count(T[i]) 
    ans = ans + (x-1+C)//C 
    if T[N-1]<t+K:
        y = N-i
    else:
        for j in range(i+((x-1+C)//C-1)*C,N):
            if T[j]>t+K:
                y = j-i
                break
 
    y=min(C,y)
    i = i + y 

print(ans)

# Optimized solution
N,C,K = list(map(int,input().split()))
T = [int(eval(input())) for i in range(N)]

T.sort()
i = 0
ans = 0
time =0
p = 0

for i in range(N):
 
    if  p==0 or p ==C:
        ans = ans+1
        p =1
        time =T[i]+K
    elif p<C :
        if T[i]<=time:
            p +=1
        elif T[i]>time:
            ans =ans+1
            time=T[i]+K
            p =1

print(ans)
# Original solution
# import sys
# sys.stdin = open('a2.in')

n, c, k = list(map(int, input().split()))
arrivals = [int(eval(input())) for i in range(n)]
arrivals.sort()

res = 0
room = c
bus_start = None

for t in arrivals:

    if room == c:
        bus_start = t

    has_left_because_angry_passenger = bus_start + k < t
    if has_left_because_angry_passenger:
        res += 1
        room = c
        bus_start = t

    room -= 1

    if room == 0:
        res += 1
        room = c

if room < c:
    res += 1

print(res)


# Optimized solution
n, c, k = list(map(int, input().split()))
arrivals = [int(eval(input())) for i in range(n)]
arrivals.sort()
 
res = 0
room = c
bus_start = None
 
for t in arrivals:
 
    previous_bus_has_left = bus_start is not None and bus_start + k < t
    if previous_bus_has_left:
        res += 1
        room = c
 
    if room == c:
        bus_start = t
 
    room -= 1
 
    if room == 0:
        res += 1
        room = c
        bus_start = None
 
if room < c:
    res += 1
 
print(res)
# Original solution
import bisect
# from collections import Counter, deque # https://note.nkmk.me/python-scipy-connected-components/
# from copy import copy, deepcopy
# from functools import reduce
# from heapq import heapify, heappop, heappush
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np  # Pythonのみ！
# from operator import xor
# import re
# from scipy.sparse.csgraph import connected_components  # Pythonのみ！
# ↑cf.  https://note.nkmk.me/python-scipy-connected-components/
# from scipy.sparse import csr_matrix
# import string
import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    N, C, K = list(map(int, input().split()))
    T = sorted([int(eval(input())) for i in range(N)])

    TT = [i + K for i in T]

    cnt = 0
    i = 0
    temp = -1
    while True:
        i = bisect.bisect_right(T, TT[i])
        if i - temp > C:
            i = temp + C + 1
            temp += C
        cnt += 1
        temp=i-1
        if i >= N:
            break
    print(cnt)


resolve()

# Optimized solution
import bisect
import sys
def input(): return sys.stdin.readline().strip()


N, C, K = list(map(int, input().split()))
T = sorted([int(eval(input())) for i in range(N)])

TT = [i + K for i in T]

cnt = 0
i = 0
temp = -1  # temp番まで運び終わった
while True:
    i = bisect.bisect_right(T, TT[i])
    if i - temp > C:
        i = temp + C + 1
        temp += C
    cnt += 1
    temp = i - 1
    if i >= N:
        break
print(cnt)
# Original solution
from functools import lru_cache

N, A = list(map(int, input().split()))
x = list(map(int, input().split()))
sum_x = sum(x)
X = max(x + [A])

answer = 0

@lru_cache(maxsize=None)
def solve(j, k, s):
    global x
    if j == 0 and k == 0 and s == 0:
        return 1
    elif j >= 1 and s < x[j - 1]:
        return solve(j-1, k, s)
    elif j >= 1 and k >= 1 and s >= x[j - 1]:
        return solve(j-1, k, s) + solve(j-1, k - 1, s - x[j - 1])
    else:
        return 0

for k in range(1, N + 1):
    answer += solve(N, k, k * A)
print(answer)


# Optimized solution
from functools import lru_cache

N, A = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list([i - A for i in x])
X = max(max(x), A)

@lru_cache(maxsize=None)
def solve(j, t):
    global y
    if j == 0 and t == 0:
        return 1
    elif j >= 1 and (t < y[j - 1] - N * X or t > y[j - 1] + N * X):
        return solve(j - 1, t)
    elif j >= 1 and t >= y[j - 1] - N * X and t <= y[j - 1] + N * X:
        return solve(j - 1, t) + solve(j - 1, t - y[j - 1])
    else:
        return 0

print((solve(N, 0) - 1))
# Original solution
from itertools import product

N, A = list(map(int, input().split()))
x = [int(xi) for xi in input().split()]
x_max = max(max(x), A)

dp = [[[0 for _ in range((N + 1) * x_max)]
      for _ in range(N + 1)]
      for _ in range(N + 1)]

dp[0][0][0] = 1

for j, k, s in product(list(range(1, N + 1)),
                       list(range(N + 1)),
                       list(range((N + 1) * x_max))):
    if s < x[j - 1]:
        dp[j][k][s] = dp[j - 1][k][s]
    elif k >= 1 and s >= x[j - 1]:
        dp[j][k][s] = dp[j - 1][k][s] + dp[j - 1][k - 1][s - x[j - 1]]

answer = sum([dp[N][k][k*A] for k in range(1, N + 1)])
print(answer)


# Optimized solution
from itertools import product

N, A = list(map(int, input().split()))
x = [int(xi) for xi in input().split()]
y = [xi - A for xi in x]
X = max(max(x), A)

dp = [[0 for _ in range(2 * N * X + 1)] for _ in range(N + 1)]

dp[0][N * X] = 1
for k, t in product(list(range(1, N + 1)), list(range(2 * N * X + 1))):
    if k > 0 and (t - y[k - 1] < 0 or t - y[k - 1] > 2 * N * X):
        dp[k][t] = dp[k - 1][t]
    elif k > 0 and t - y[k - 1] <= 2 * N * X:
        dp[k][t] = dp[k - 1][t] + dp[k - 1][t - y[k - 1]]

print((dp[N][N * X] - 1))
# Original solution
from itertools import combinations

N, A = list(map(int, input().split()))
l = list(map(int, input().split()))
cnt = 0

for i in range(1,N+1):
	for cmb in combinations(l,i):
		if sum(cmb) / i == A:
			cnt += 1

print(cnt)

# Optimized solution
N, A = list(map(int, input().split()))
X = list([int(x) - A for x in input().split()])
dp = [[0 for j in range(100 * N + 1)] for i in range(N+1)]
dp[0][50 * N] = 1
for i in range(N):
	for j in range(50, 100*N + 1-50):
		dp[i+1][j] = dp[i][j] + dp[i][j - X[i]]
print((dp[N][50 * N] -1))
# Original solution
import collections
N, A = list(map(int, input().split()))
xs = list(map(int, input().split()))

dp = collections.defaultdict(lambda: 0)
dp[(0, 0)] = 1
for n, x in enumerate(xs, start=1):
    for (k, accum), count in list(dp.items()):
        dp[(k + 1, accum + x)] += count
found = 0
for (k, accum), count in list(dp.items()):
    if k > 0 and k * A == accum:
        found += count
print(found)

# Optimized solution
import collections
N, A = list(map(int, input().split()))
ys = [int(x) - A for x in input().split()]

dp = collections.defaultdict(lambda: 0)
dp[0] = 1
for y in ys:
    for accum, count in list(dp.items()):
        dp[accum + y] += count
found = -1 # for dp[0]
for accum, count in list(dp.items()):
    if accum == 0:
        found += count
print(found)
# Original solution
def f(n,x,i):
    if n == 0:
        if i != 0:
            if x/i == m:
                return 1
        return 0
    if memo[n-1][i][x] != -1 :
        if memo[n-1][i][x] > 0:
            return memo[n-1][i][x]
    memo[n-1][i][x] = f(n-1,x,i)+f(n-1,x+a[n-1],i+1)
    return memo[n-1][i][x]

n, m= list(map(int,input().split()))
a = list(map(int,input().split()))
memo = [[[-1 for _ in range(sum(a)+1)]for i in range(n)]for i in range(n)]
print((f(n,0,0)))

# Optimized solution
def f(n,x,i):
    if n == 0:
        if i != 0:
            if x/i == m:
                return 1
        return 0
    if memo[n-1][i][x] != -1 :
        return memo[n-1][i][x]
    memo[n-1][i][x] = f(n-1,x,i)+f(n-1,x+a[n-1],i+1)
    return memo[n-1][i][x]

n, m= list(map(int,input().split()))
a = list(map(int,input().split()))
memo = [[[-1 for _ in range(sum(a)+1)]for i in range(n)]for i in range(n)]
print((f(n,0,0)))
# Original solution
def f(n,x,i):
    if n == 0:
        if i != 0:
            if x/i == m:
                return 1
        return 0
    if memo[n-1][i][x] != -1 :
        return memo[n-1][i][x]
    memo[n-1][i][x] = f(n-1,x,i)+f(n-1,x+a[n-1],i+1)
    return memo[n-1][i][x]

n, m= list(map(int,input().split()))
a = list(map(int,input().split()))
memo = [[[-1 for _ in range(sum(a)+1)]for i in range(n)]for i in range(n)]
print((f(n,0,0)))

# Optimized solution
def f(n,x,i):
    if n == 0:
        if x != 0:
            if x / i == a:
                return 1
        return 0
    if memo[i][n][x] != -1:
        return memo[i][n][x]
    memo[i][n][x] = f(n-1,x,i)+f(n-1,x+ary[n-1],i+1)
    return memo[i][n][x]
n,a = list(map(int,input().split()))
ary = list(map(int,input().split()))
memo = [[[-1 for _ in range(sum(ary)+1)] for _ in range(n+1)] for _ in range(n+1)]
print((f(n,0,0)))
# Original solution
def larger(x, y):
	if x > y: return x
	else: return y

N, A = list(map(int, input().split()))
x = list(map(int, input().split()))
x.sort()
max = larger(x[-1], A)
dp = []

for i in range(0, N+1):
	tmp1 = []
	for j in range(0, N+1):
		tmp2 = []
		for k in range(0, N*max+1):
			tmp2.append(0)
		tmp1.append(tmp2)
	dp.append(tmp1)

for i in range(0, N+1):
	for j in range(0, N+1):
		for k in range(0, N*max+1):
			if i == 0:
				if j == 0 and k == 0: dp[i][j][k] = 1
			else:
				if k < x[i-1]: dp[i][j][k] = dp[i-1][j][k]
				elif j >= 1:
					dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][k-x[i-1]]

ans = 0
for i in range(1, N+1):
	ans = ans + dp[N][i][i*A]
print(ans)

# Optimized solution
def larger(x, y):
	if x > y: return x
	else: return y

N, A = list(map(int, input().split()))
x = list(map(int, input().split()))
x = [a-A for a in x]
max = larger(x[-1], A)
dp = []

for i in range(0, N+1):
	tmp = []
	for j in range(0, 2*N*max+1):
		tmp.append(0)
	dp.append(tmp)

for i in range(0, N+1):
	for j in range(0, 2*N*max+1):
		if i == 0:
			if j == N*max: dp[i][j] = 1
		else:
			if j-x[i-1] < 0 or j-x[i-1] > 2*N*max:
				dp[i][j] = dp[i-1][j]
			else:
				dp[i][j] = dp[i-1][j] + dp[i-1][j-x[i-1]]

print(dp[N][N*max]-1)
# Original solution
N, A, *x = list(map(int, open(0).read().split()))

c_nx = N * max(x + [A])
dp = [[[0] * (c_nx + 1) for _ in range(N + 1)] 
      for _ in range(N + 1)]
x = [0] + x

dp[0][0][0] = 1
for j in range(1, N + 1):
    for k in range(N + 1):
        for s in range(c_nx + 1):
            if s < x[j]:
                dp[j][k][s] = dp[j - 1][k][s]
            elif s >= x[j]:
                dp[j][k][s] = dp[j - 1][k][s] + dp[j - 1][k - 1][s - x[j]]
                
print((sum(dp[N][k][k * A] for k in range(1, N + 1))))

# Optimized solution
N, A, *x = list(map(int, open(0).read().split()))

NX = N * max(x + [A])
y = [0] + [v - A for v in x]
dp = [[0] * (2 * NX + 1) for _ in range(N + 1)]

dp[0][NX] = 1  
for j in range(1, N + 1):
    for t in range(2 * NX + 1):
        if t - y[j] < 0 or t - y[j] > 2 * NX:
            dp[j][t] = dp[j - 1][t]
        elif 0 <= t - y[j] <= 2 * NX:
            dp[j][t] = dp[j - 1][t] + dp[j - 1][t - y[j]]
                
print((dp[N][NX] - 1))