N,M=map(int,input().split())
Like=[0 for i in range(M)]
A=[[] for i in range(N)]
for i in range(N):
  A[i]=[int(x) for x in input().split()]
for i in range(N):
  for j in range(1,A[i][0]+1):
    Like[A[i][j]-1]=Like[A[i][j]-1]+1
print(Like.count(N)) N,M=map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M 0 for i in range(M) for i in range(M) i range(M) range M for i in range(M) 0 Like=[0 for i in range(M)] Like [0 for i in range(M)] [] for i in range(N) for i in range(N) i range(N) range N for i in range(N) [] A=[[] for i in range(N)] A [[] for i in range(N)] for i in range(N):
  A[i]=[int(x) for x in input().split()] i range(N) range N int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x A[i]=[int(x) for x in input().split()] A[i] A i [int(x) for x in input().split()] for i in range(N):
  for j in range(1,A[i][0]+1):
    Like[A[i][j]-1]=Like[A[i][j]-1]+1 i range(N) range N for j in range(1,A[i][0]+1):
    Like[A[i][j]-1]=Like[A[i][j]-1]+1 j range(1,A[i][0]+1) range 1 A[i][0]+1 A[i][0] [i] A i 0 1 Like[A[i][j]-1]=Like[A[i][j]-1]+1 Like[A[i][j]-1] Like A[i][j]-1 A[i][j] [i] A i j 1 Like[A[i][j]-1]+1 Like[A[i][j]-1] Like A[i][j]-1 A[i][j] [i] A i j 1 1 print(Like.count(N)) print Like.count(N) Like.count Like count N Like=[0 for i in range(M)] [0 for i in range(M)] Like M=map(int,input().split()) map(int,input().split()) M A=[[] for i in range(N)] [[] for i in range(N)] A N,M=map(int,input().split()) map(int,input().split()) N
N,M=map(int,input().split())
Like=[0 for i in range(M)]
A=[[] for i in range(N)]
for i in range(N):
  A[i]=[int(x) for x in input().split()]
for i in range(N):
  for j in range(1,A[i][0]+1):
    Like[A[i][j]-1]=Like[A[i][j]-1]+1
print(Like.count(N))