n,m = map(int,input().split())
s = set(range(1,m+1))
for i in range(n):
    k,*a = map(int,input().split())
    s &= set(a)
print(len(s)) n,m = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m s = set(range(1,m+1)) s set(range(1,m+1)) set range(1,m+1) range 1 m+1 m 1 for i in range(n):
    k,*a = map(int,input().split())
    s &= set(a) i range(n) range n k,*a = map(int,input().split()) k map(int,input().split()) map int input().split() ().split () input split *a a s &= set(a) s set(a) set a print(len(s)) print len(s) len s m = map(int,input().split()) map(int,input().split()) m n,m = map(int,input().split()) map(int,input().split()) n s &= set(a) set(a) s k,*a = map(int,input().split()) map(int,input().split()) k s = set(range(1,m+1)) set(range(1,m+1)) s
n,m = map(int,input().split())
s = set(range(1,m+1))
for i in range(n):
    k,*a = map(int,input().split())
    s &= set(a)
print(len(s))