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