n,m = map(int,input().split())
L = [i for i in range(1,m+1)]
for j in range(n):
    l = list(map(int,input().split()))
    del l[0]
    L = set(l) & set(L)
print(len(L)) n,m = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m i 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) i L = [i for i in range(1,m+1)] L [i for i in range(1,m+1)] for j in range(n):
    l = list(map(int,input().split()))
    del l[0]
    L = set(l) & set(L) j range(n) range n l = list(map(int,input().split())) l list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split del l[0] l[0] l 0 L = set(l) & set(L) L set(l) & set(L) set(l) set l set(L) set L print(len(L)) print len(L) len L l = list(map(int,input().split())) list(map(int,input().split())) l n,m = map(int,input().split()) map(int,input().split()) n m = map(int,input().split()) map(int,input().split()) m L = set(l) & set(L) set(l) & set(L) L L = [i for i in range(1,m+1)] [i for i in range(1,m+1)] L
n,m = map(int,input().split())
L = [i for i in range(1,m+1)]
for j in range(n):
    l = list(map(int,input().split()))
    del l[0]
    L = set(l) & set(L)
print(len(L))