# -*- coding: utf-8 -*-

"""

http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_4_A

TLE

"""

import sys

from sys import stdin

from bisect import bisect_right, bisect_left

input = stdin.readline

 

 

def main(args):

    N, V = list(map(int, input().split()))

    A = [int(x) for x in input().split()]

    B = [int(x) for x in input().split()]

    C = [int(x) for x in input().split()]

    D = [int(x) for x in input().split()]

 

    AB = []

    for i in A:

        for j in B:

           AB.append(i+j)

    AB.sort()

 

    CD = [float('-inf'), float('inf')]

    for i in C:

        for j in D:

           CD.append(i+j)

    CD.sort()

 

    count = 0

    for ab in AB:

        i = bisect_left(CD, V - ab)

        j = bisect_right(CD, V - ab)

        count += max((j-i), 0)

 

    print(count)

 

 

if __name__ == '__main__':

    main(sys.argv[1:])
# -*- coding: utf-8 -*-

"""

http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_4_A

AC

"""

import sys

from sys import stdin

from bisect import bisect_right, bisect_left

input = stdin.readline





def main(args):

    N, V = list(map(int, input().split()))

    A = [int(x) for x in input().split()]

    B = [int(x) for x in input().split()]

    C = [int(x) for x in input().split()]

    D = [int(x) for x in input().split()]



    #AB = []

    #for i in A:

    #    for j in B:

    #       AB.append(i+j)

    AB = [a+b for a in A for b in B]

    #AB.sort()



    #CD = [float('-inf'), float('inf')]

    #for i in C:

    #    for j in D:

    #       CD.append(i+j)

    CD = [c+d for c in C for d in D]

    CD.append(float('-inf'))

    CD.append(float('inf'))

    CD.sort()



    count = 0

    for ab in AB:

        i = bisect_left(CD, V - ab)

        j = bisect_right(CD, V - ab)

        count += max((j-i), 0)



    print(count)





if __name__ == '__main__':

    main(sys.argv[1:])
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_4_A
TLE
"""
import sys
from sys import stdin
from bisect import bisect_right, bisect_left

input = stdin.readline


def main(args):
    N, V = list(map(int, input().split()))
    A = [int(x) for x in input().split()]
    B = [int(x) for x in input().split()]
    C = [int(x) for x in input().split()]
    D = [int(x) for x in input().split()]
    AB = []
    for i in A:
        for j in B:
            AB.append(i + j)
    AB.sort()
    CD = [float("-inf"), float("inf")]
    for i in C:
        for j in D:
            CD.append(i + j)
    CD.sort()
    count = 0
    for ab in AB:
        i = bisect_left(CD, V - ab)
        j = bisect_right(CD, V - ab)
        count += max((j - i), 0)
    print(count)


if __name__ == "__main__":
    main(sys.argv[1:])

# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_4_A
AC
"""
import sys
from sys import stdin
from bisect import bisect_right, bisect_left

input = stdin.readline


def main(args):
    N, V = list(map(int, input().split()))
    A = [int(x) for x in input().split()]
    B = [int(x) for x in input().split()]
    C = [int(x) for x in input().split()]
    D = [int(x) for x in input().split()]
    # AB = []
    # for i in A:
    #    for j in B:
    #       AB.append(i+j)
    AB = [a + b for a in A for b in B]
    # AB.sort()
    # CD = [float('-inf'), float('inf')]
    # for i in C:
    #    for j in D:
    #       CD.append(i+j)
    CD = [c + d for c in C for d in D]
    CD.append(float("-inf"))
    CD.append(float("inf"))
    CD.sort()
    count = 0
    for ab in AB:
        i = bisect_left(CD, V - ab)
        j = bisect_right(CD, V - ab)
        count += max((j - i), 0)
    print(count)


if __name__ == "__main__":
    main(sys.argv[1:])

-TLE +AC -    AB = [] -    for i in A: -        for j in B: -            AB.append(i + j) -    AB.sort() -    CD = [float("-inf"), float("inf")] -    for i in C: -        for j in D: -            CD.append(i + j) +    # AB = [] +    # for i in A: +    #    for j in B: +    #       AB.append(i+j) +    AB = [a + b for a in A for b in B] +    # AB.sort() +    # CD = [float('-inf'), float('inf')] +    # for i in C: +    #    for j in D: +    #       CD.append(i+j) +    CD = [c + d for c in C for d in D] +    CD.append(float("-inf")) +    CD.append(float("inf"))