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

flg = [0] * (m+1)
for i in range(n):
  for j in range(1,ka[i][0]+1):
    food = ka[i][j]
    flg[food] += 1

result = 0
for i in range(m+1):
  if flg[i] == n:
    result += 1
print(result) 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 ka=[list(map(int,input().split())) for _ in range(n)] ka [list(map(int,input().split())) for _ in range(n)] flg = [0] * (m+1) flg [0] * (m+1) [0] 0 m+1 m 1 for i in range(n):
  for j in range(1,ka[i][0]+1):
    food = ka[i][j]
    flg[food] += 1 i range(n) range n for j in range(1,ka[i][0]+1):
    food = ka[i][j]
    flg[food] += 1 j range(1,ka[i][0]+1) range 1 ka[i][0]+1 ka[i][0] [i] ka i 0 1 food = ka[i][j] food ka[i][j] [i] ka i j flg[food] += 1 flg[food] flg food 1 result = 0 result 0 for i in range(m+1):
  if flg[i] == n:
    result += 1 i range(m+1) range m+1 m 1 if flg[i] == n:
    result += 1 flg[i] == n flg[i] flg i n result += 1 result 1 print(result) print result flg = [0] * (m+1) [0] * (m+1) flg food = ka[i][j] ka[i][j] food m=map(int,input().split()) map(int,input().split()) m ka=[list(map(int,input().split())) for _ in range(n)] [list(map(int,input().split())) for _ in range(n)] ka n,m=map(int,input().split()) map(int,input().split()) n result = 0 0 result result += 1 1 result
n,m=map(int,input().split())
ka=[list(map(int,input().split())) for _ in range(n)]

flg = [0] * (m+1)
for i in range(n):
  for j in range(1,ka[i][0]+1):
    food = ka[i][j]
    flg[food] += 1

result = 0
for i in range(m+1):
  if flg[i] == n:
    result += 1
print(result)