n,m=map(int, input().split())
alist=[0]*(m+1)
for i in range(n):
  blist=list(map(int, input().split()))
  for j in range(blist[0]):
    alist[blist[j+1]]+=1
cnt=0
for i in range(m+1):
  if alist[i]==n:
    cnt+=1
print(cnt) n,m=map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m alist=[0]*(m+1) alist [0]*(m+1) [0] 0 m+1 m 1 for i in range(n):
  blist=list(map(int, input().split()))
  for j in range(blist[0]):
    alist[blist[j+1]]+=1 i range(n) range n blist=list(map(int, input().split())) blist list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split for j in range(blist[0]):
    alist[blist[j+1]]+=1 j range(blist[0]) range blist[0] blist 0 alist[blist[j+1]]+=1 alist[blist[j+1]] alist blist[j+1] blist j+1 j 1 1 cnt=0 cnt 0 for i in range(m+1):
  if alist[i]==n:
    cnt+=1 i range(m+1) range m+1 m 1 if alist[i]==n:
    cnt+=1 alist[i]==n alist[i] alist i n cnt+=1 cnt 1 print(cnt) print cnt m=map(int, input().split()) map(int, input().split()) m alist=[0]*(m+1) [0]*(m+1) alist cnt=0 0 cnt blist=list(map(int, input().split())) list(map(int, input().split())) blist cnt+=1 1 cnt n,m=map(int, input().split()) map(int, input().split()) n
n,m=map(int, input().split())
alist=[0]*(m+1)
for i in range(n):
  blist=list(map(int, input().split()))
  for j in range(blist[0]):
    alist[blist[j+1]]+=1
cnt=0
for i in range(m+1):
  if alist[i]==n:
    cnt+=1
print(cnt)