n,m = map( int,input().split() )
k = [ list(map( int,input().split() )) for _ in range(n) ]

c = [0] * (m+1)

for i in k:
  for j,data in enumerate(i):
    if j == 0:
      continue
    else:
      c[data] += 1

ans = 0
for i in c:
  if i == n:
    ans += 1

print(ans) n,m = map( int,input().split() ) n map( int,input().split() ) map int input().split() ().split () input split m list(map( int,input().split() )) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) list(map( int,input().split() )) list map( int,input().split() ) map int input().split() ().split () input split k = [ list(map( int,input().split() )) for _ in range(n) ] k [ list(map( int,input().split() )) for _ in range(n) ] c = [0] * (m+1) c [0] * (m+1) [0] 0 m+1 m 1 for i in k:
  for j,data in enumerate(i):
    if j == 0:
      continue
    else:
      c[data] += 1 i k for j,data in enumerate(i):
    if j == 0:
      continue
    else:
      c[data] += 1 j data enumerate(i) enumerate i if j == 0:
      continue
    else:
      c[data] += 1 j == 0 j 0 continue c[data] += 1 c[data] c data 1 ans = 0 ans 0 for i in c:
  if i == n:
    ans += 1 i c if i == n:
    ans += 1 i == n i n ans += 1 ans 1 print(ans) print ans k = [ list(map( int,input().split() )) for _ in range(n) ] [ list(map( int,input().split() )) for _ in range(n) ] k ans += 1 1 ans c = [0] * (m+1) [0] * (m+1) c n,m = map( int,input().split() ) map( int,input().split() ) n ans = 0 0 ans m = map( int,input().split() ) map( int,input().split() ) m
n,m = map( int,input().split() )
k = [ list(map( int,input().split() )) for _ in range(n) ]

c = [0] * (m+1)

for i in k:
  for j,data in enumerate(i):
    if j == 0:
      continue
    else:
      c[data] += 1

ans = 0
for i in c:
  if i == n:
    ans += 1

print(ans)
