import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)


############ ---- Input Functions ---- ############
def in_int():
    return (int(input()))


def in_list():
    return (list(map(int, input().split())))


def in_str():
    s = input()
    return (list(s[:len(s) - 1]))


def in_ints():
    return (map(int, input().split()))


n ,  k = in_ints()


a = [0] + in_list()

ans = 0

m = {}


def fun(i, val):
    if (i, val) not in m:
        if i < 0 or val < 0:
            m[(i, val)] = 0
        elif val == 0:
            m[(i, val)] = i+1
        else:
            m[(i, val)] = fun(i-1, val - a[i]) + fun(i - 1, val)

    return m[(i, val)]


i = 0
j = 0
for xx in a[1:]:
    i+=1
    l = fun(i-1, k- xx)

    ans  += l*(n-i+1)


print(ans)
