n,m=map(int,input().split())
x=[0 for i in range(n)]
a=[0 for j in range(m)]
ans=0
for i in range(n):
    x[i]=list(map(int,input().split()))
    for j in range(1,x[i][0]+1):
         a[x[i][j]-1]+=1

for s in range(m):
    if n==a[s]:
        ans+=1
print(ans) n,m=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m 0 for i in range(n) for i in range(n) i range(n) range n for i in range(n) 0 x=[0 for i in range(n)] x [0 for i in range(n)] 0 for j in range(m) for j in range(m) j range(m) range m for j in range(m) 0 a=[0 for j in range(m)] a [0 for j in range(m)] ans=0 ans 0 for i in range(n):
    x[i]=list(map(int,input().split()))
    for j in range(1,x[i][0]+1):
         a[x[i][j]-1]+=1 i range(n) range n x[i]=list(map(int,input().split())) x[i] x i list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split for j in range(1,x[i][0]+1):
         a[x[i][j]-1]+=1 j range(1,x[i][0]+1) range 1 x[i][0]+1 x[i][0] [i] x i 0 1 a[x[i][j]-1]+=1 a[x[i][j]-1] a x[i][j]-1 x[i][j] [i] x i j 1 1 for s in range(m):
    if n==a[s]:
        ans+=1 s range(m) range m if n==a[s]:
        ans+=1 n==a[s] n a[s] a s ans+=1 ans 1 print(ans) print ans n,m=map(int,input().split()) map(int,input().split()) n m=map(int,input().split()) map(int,input().split()) m x=[0 for i in range(n)] [0 for i in range(n)] x ans+=1 1 ans ans=0 0 ans a=[0 for j in range(m)] [0 for j in range(m)] a
n,m=map(int,input().split())
x=[0 for i in range(n)]
a=[0 for j in range(m)]
ans=0
for i in range(n):
    x[i]=list(map(int,input().split()))
    for j in range(1,x[i][0]+1):
         a[x[i][j]-1]+=1

for s in range(m):
    if n==a[s]:
        ans+=1
print(ans)