n, m = map(int, input().split())
point = [0] * m
ans = 0
for i in range(n) :
    data = list(map(int, input().split()))
    for j in range(1,data[0]+1) :
        point[data[j]-1] += 1
for k in range(m) :
    if point[k] == n :
        ans += 1
print(ans) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m point = [0] * m point [0] * m [0] 0 m ans = 0 ans 0 for i in range(n) :
    data = list(map(int, input().split()))
    for j in range(1,data[0]+1) :
        point[data[j]-1] += 1 i range(n) range n data = list(map(int, input().split())) data list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split for j in range(1,data[0]+1) :
        point[data[j]-1] += 1 j range(1,data[0]+1) range 1 data[0]+1 data[0] data 0 1 point[data[j]-1] += 1 point[data[j]-1] point data[j]-1 data[j] data j 1 1 for k in range(m) :
    if point[k] == n :
        ans += 1 k range(m) range m if point[k] == n :
        ans += 1 point[k] == n point[k] point k n ans += 1 ans 1 print(ans) print ans n, m = map(int, input().split()) map(int, input().split()) n point = [0] * m [0] * m point ans = 0 0 ans ans += 1 1 ans data = list(map(int, input().split())) list(map(int, input().split())) data m = map(int, input().split()) map(int, input().split()) m
n, m = map(int, input().split())
point = [0] * m
ans = 0
for i in range(n) :
    data = list(map(int, input().split()))
    for j in range(1,data[0]+1) :
        point[data[j]-1] += 1
for k in range(m) :
    if point[k] == n :
        ans += 1
print(ans)
