n, m = map(int, input().split())
food = {i+1 for i in range(m)}

for i in range(n):
    k, *l = map(int, input().split())
    food = set(l) & food

print(len(food)) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m i+1 for i in range(m) for i in range(m) i range(m) range m for i in range(m) i+1 i 1 food = {i+1 for i in range(m)} food for i in range(n):
    k, *l = map(int, input().split())
    food = set(l) & food i range(n) range n k, *l = map(int, input().split()) k map(int, input().split()) map int input().split() ().split () input split *l l food = set(l) & food food set(l) & food set(l) set l food print(len(food)) print len(food) len food k, *l = map(int, input().split()) map(int, input().split()) k n, m = map(int, input().split()) map(int, input().split()) n m = map(int, input().split()) map(int, input().split()) m food = {i+1 for i in range(m)} food food = set(l) & food set(l) & food food
n, m = map(int, input().split())
food = {i+1 for i in range(m)}

for i in range(n):
    k, *l = map(int, input().split())
    food = set(l) & food

print(len(food))