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

x = [0]*m

for i in range(n):
  for k in range(1,a[i][0]+1):
    x[a[i][k]-1] += 1
count = 0
for i in range(m):
  if x[i] == n:
    count += 1
print(count) n,m = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m a=[] a [] for _ in range(n):
  a.append(list(map(int,input().split()))) _ range(n) range n a.append(list(map(int,input().split()))) a.append a append list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split x = [0]*m x [0]*m [0] 0 m for i in range(n):
  for k in range(1,a[i][0]+1):
    x[a[i][k]-1] += 1 i range(n) range n for k in range(1,a[i][0]+1):
    x[a[i][k]-1] += 1 k range(1,a[i][0]+1) range 1 a[i][0]+1 a[i][0] [i] a i 0 1 x[a[i][k]-1] += 1 x[a[i][k]-1] x a[i][k]-1 a[i][k] [i] a i k 1 1 count = 0 count 0 for i in range(m):
  if x[i] == n:
    count += 1 i range(m) range m if x[i] == n:
    count += 1 x[i] == n x[i] x i n count += 1 count 1 print(count) print count a=[] [] a x = [0]*m [0]*m x n,m = map(int,input().split()) map(int,input().split()) n m = map(int,input().split()) map(int,input().split()) m count = 0 0 count count += 1 1 count
n,m = map(int,input().split())
a=[]
for _ in range(n):
  a.append(list(map(int,input().split())))

x = [0]*m

for i in range(n):
  for k in range(1,a[i][0]+1):
    x[a[i][k]-1] += 1
count = 0
for i in range(m):
  if x[i] == n:
    count += 1
print(count)