n, m = map(int, input().split())

# print(n)
# print(m)

d = {str(i):0 for i in range(1, m + 1)}
# print(d)

for _ in range(n):
    l = input().split()
    k = l[0]
    a = l[1:]
    
    # print(k)
    # print(a)
    
    for aa in a:
        d[aa] += 1
        
# print(d)

count = 0
for key, value in d.items():
    if value == n:
        count += 1
        
print(count) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m str(i):0 for i in range(1, m + 1) for i in range(1, m + 1) i range(1, m + 1) range 1 m + 1 m 1 for i in range(1, m + 1) str(i) str i 0 d = {str(i):0 for i in range(1, m + 1)} d {str(i):0 for i in range(1, m + 1)} for _ in range(n):
    l = input().split()
    k = l[0]
    a = l[1:]
    
    # print(k)
    # print(a)
    
    for aa in a:
        d[aa] += 1
        
# print(d) _ range(n) range n l = input().split() l input().split() ().split () input split k = l[0] k l[0] l 0 a = l[1:] a l[1:] l 1: 1 for aa in a:
        d[aa] += 1
        
# print(d) aa a d[aa] += 1 d[aa] d aa 1 count = 0 count 0 for key, value in d.items():
    if value == n:
        count += 1
         key value d.items() d.items d items if value == n:
        count += 1
         value == n value n count += 1 count 1 print(count) print count d = {str(i):0 for i in range(1, m + 1)} {str(i):0 for i in range(1, m + 1)} d m = map(int, input().split()) map(int, input().split()) m a = l[1:] l[1:] a l = input().split() input().split() l count += 1 1 count n, m = map(int, input().split()) map(int, input().split()) n count = 0 0 count k = l[0] l[0] k
n, m = map(int, input().split())

# print(n)
# print(m)

d = {str(i):0 for i in range(1, m + 1)}
# print(d)

for _ in range(n):
    l = input().split()
    k = l[0]
    a = l[1:]
    
    # print(k)
    # print(a)
    
    for aa in a:
        d[aa] += 1
        
# print(d)

count = 0
for key, value in d.items():
    if value == n:
        count += 1
        
print(count)