N,M=map(int,input().split())
h={i for i in range(1,M+1)}
for _ in range(N):
  a=list(map(int,input().split()))
  a=set(a[1:])
  h&=a
print(len(h)) 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 h={i for i in range(1,M+1)} h for _ in range(N):
  a=list(map(int,input().split()))
  a=set(a[1:])
  h&=a _ range(N) range N a=list(map(int,input().split())) a list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split a=set(a[1:]) a set(a[1:]) set a[1:] a 1: 1 h&=a h a print(len(h)) print len(h) len h N,M=map(int,input().split()) map(int,input().split()) N M=map(int,input().split()) map(int,input().split()) M h={i for i in range(1,M+1)} h h&=a a h a=list(map(int,input().split())) list(map(int,input().split())) a a=set(a[1:]) set(a[1:]) a
N,M=map(int,input().split())
h={i for i in range(1,M+1)}
for _ in range(N):
  a=list(map(int,input().split()))
  a=set(a[1:])
  h&=a
print(len(h))