n, m = map(int, input().split())
s = set(map(str, range(m+1)))
for _ in range(n):
    s &= set(input().split()[1:])
print(len(s)) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m s = set(map(str, range(m+1))) s set(map(str, range(m+1))) set map(str, range(m+1)) map str range(m+1) range m+1 m 1 for _ in range(n):
    s &= set(input().split()[1:]) _ range(n) range n s &= set(input().split()[1:]) s set(input().split()[1:]) set input().split()[1:] ().split() ().split () input split 1: 1 print(len(s)) print len(s) len s m = map(int, input().split()) map(int, input().split()) m s &= set(input().split()[1:]) set(input().split()[1:]) s n, m = map(int, input().split()) map(int, input().split()) n s = set(map(str, range(m+1))) set(map(str, range(m+1))) s
n, m = map(int, input().split())
s = set(map(str, range(m+1)))
for _ in range(n):
    s &= set(input().split()[1:])
print(len(s))