n, m = map(int, input().split())
chk = [0]*(m+1)
for i in range(n):
    inp = list(map(int, input().split()))
    k = inp[0]
    for j in range(1,k+1):
        chk[inp[j]] += 1
print(chk.count(n)) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m chk = [0]*(m+1) chk [0]*(m+1) [0] 0 m+1 m 1 for i in range(n):
    inp = list(map(int, input().split()))
    k = inp[0]
    for j in range(1,k+1):
        chk[inp[j]] += 1 i range(n) range n inp = list(map(int, input().split())) inp list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split k = inp[0] k inp[0] inp 0 for j in range(1,k+1):
        chk[inp[j]] += 1 j range(1,k+1) range 1 k+1 k 1 chk[inp[j]] += 1 chk[inp[j]] chk inp[j] inp j 1 print(chk.count(n)) print chk.count(n) chk.count chk count n k = inp[0] inp[0] k n, m = map(int, input().split()) map(int, input().split()) n chk = [0]*(m+1) [0]*(m+1) chk m = map(int, input().split()) map(int, input().split()) m inp = list(map(int, input().split())) list(map(int, input().split())) inp
n, m = map(int, input().split())
chk = [0]*(m+1)
for i in range(n):
    inp = list(map(int, input().split()))
    k = inp[0]
    for j in range(1,k+1):
        chk[inp[j]] += 1
print(chk.count(n))