n,m = map(int,input().split())
ans = [int(0) for i in range(m+1)]
for i in range(n):
    k = list(map(int,input().split()))
    for j in range(1,k[0]+1):
        ans[k[j]] += 1
#print(ans)
cnt = 0
for i in range(1,len(ans)):
    if ans[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 int(0) for i in range(m+1) for i in range(m+1) i range(m+1) range m+1 m 1 for i in range(m+1) int(0) int 0 ans = [int(0) for i in range(m+1)] ans [int(0) for i in range(m+1)] for i in range(n):
    k = list(map(int,input().split()))
    for j in range(1,k[0]+1):
        ans[k[j]] += 1
#print(ans) i range(n) range n k = list(map(int,input().split())) k list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split for j in range(1,k[0]+1):
        ans[k[j]] += 1
#print(ans) j range(1,k[0]+1) range 1 k[0]+1 k[0] k 0 1 ans[k[j]] += 1 ans[k[j]] ans k[j] k j 1 cnt = 0 cnt 0 for i in range(1,len(ans)):
    if ans[i]==n:
        cnt += 1 i range(1,len(ans)) range 1 len(ans) len ans if ans[i]==n:
        cnt += 1 ans[i]==n ans[i] ans i n cnt += 1 cnt 1 print(cnt) print cnt m = map(int,input().split()) map(int,input().split()) m n,m = map(int,input().split()) map(int,input().split()) n k = list(map(int,input().split())) list(map(int,input().split())) k cnt += 1 1 cnt cnt = 0 0 cnt ans = [int(0) for i in range(m+1)] [int(0) for i in range(m+1)] ans
n,m = map(int,input().split())
ans = [int(0) for i in range(m+1)]
for i in range(n):
    k = list(map(int,input().split()))
    for j in range(1,k[0]+1):
        ans[k[j]] += 1
#print(ans)
cnt = 0
for i in range(1,len(ans)):
    if ans[i]==n:
        cnt += 1
print(cnt)