n, m = [int(w) for w in input().split()]
menu = [0] * m

for i in range(n):
    _, *la = [int(w) for w in input().split()]
    for a in la:
        menu[a - 1] += 1

print(len([w for w in menu if w == n])) int(w) for w in input().split() for w in input().split() w input().split() ().split () input split for w in input().split() int(w) int w n, m = [int(w) for w in input().split()] n [int(w) for w in input().split()] m menu = [0] * m menu [0] * m [0] 0 m for i in range(n):
    _, *la = [int(w) for w in input().split()]
    for a in la:
        menu[a - 1] += 1 i range(n) range n int(w) for w in input().split() for w in input().split() w input().split() ().split () input split for w in input().split() int(w) int w _, *la = [int(w) for w in input().split()] _ [int(w) for w in input().split()] *la la for a in la:
        menu[a - 1] += 1 a la menu[a - 1] += 1 menu[a - 1] menu a - 1 a 1 1 w for w in menu if w == n for w in menu if w == n w menu w == n w n if w == n w print(len([w for w in menu if w == n])) print len([w for w in menu if w == n]) len [w for w in menu if w == n] n, m = [int(w) for w in input().split()] [int(w) for w in input().split()] n _, *la = [int(w) for w in input().split()] [int(w) for w in input().split()] _ menu = [0] * m [0] * m menu m = [int(w) for w in input().split()] [int(w) for w in input().split()] m
n, m = [int(w) for w in input().split()]
menu = [0] * m

for i in range(n):
    _, *la = [int(w) for w in input().split()]
    for a in la:
        menu[a - 1] += 1

print(len([w for w in menu if w == n]))
