n,m=map(int,input().split())
l=[0]*(m+1)
for u in range(n):
    d=list(map(int,input().split()))
    for i in range(1,d[0]+1):
        l[d[i]]+=1
c=0
for i in range(1,m+1):
    if(l[i]==n):
        c=c+1
print(c) n,m=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m l=[0]*(m+1) l [0]*(m+1) [0] 0 m+1 m 1 for u in range(n):
    d=list(map(int,input().split()))
    for i in range(1,d[0]+1):
        l[d[i]]+=1 u range(n) range n d=list(map(int,input().split())) d list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split for i in range(1,d[0]+1):
        l[d[i]]+=1 i range(1,d[0]+1) range 1 d[0]+1 d[0] d 0 1 l[d[i]]+=1 l[d[i]] l d[i] d i 1 c=0 c 0 for i in range(1,m+1):
    if(l[i]==n):
        c=c+1 i range(1,m+1) range 1 m+1 m 1 if(l[i]==n):
        c=c+1 l[i]==n l[i] l i n c=c+1 c c+1 c 1 print(c) print c l=[0]*(m+1) [0]*(m+1) l c=c+1 c+1 c n,m=map(int,input().split()) map(int,input().split()) n c=0 0 c m=map(int,input().split()) map(int,input().split()) m d=list(map(int,input().split())) list(map(int,input().split())) d
n,m=map(int,input().split())
l=[0]*(m+1)
for u in range(n):
    d=list(map(int,input().split()))
    for i in range(1,d[0]+1):
        l[d[i]]+=1
c=0
for i in range(1,m+1):
    if(l[i]==n):
        c=c+1
print(c)
