n, m = [int(i) for i in input().split()]
list_a = [[s for s in input().split()] for i in range(0, n)]
list_ans = [str(s) for s in range(1, m + 1)]
for i in range(0, n):
    for j in range(0, m):
        if list_ans[j] not in list_a[i][1:]:
            list_ans[j] = '0'
print(len([s for s in list_ans if s != '0'])) int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i n, m = [int(i) for i in input().split()] n [int(i) for i in input().split()] m [s for s in input().split()] for i in range(0, n) for i in range(0, n) i range(0, n) range 0 n for i in range(0, n) [s for s in input().split()] list_a = [[s for s in input().split()] for i in range(0, n)] list_a [[s for s in input().split()] for i in range(0, n)] str(s) for s in range(1, m + 1) for s in range(1, m + 1) s range(1, m + 1) range 1 m + 1 m 1 for s in range(1, m + 1) str(s) str s list_ans = [str(s) for s in range(1, m + 1)] list_ans [str(s) for s in range(1, m + 1)] for i in range(0, n):
    for j in range(0, m):
        if list_ans[j] not in list_a[i][1:]:
            list_ans[j] = '0' i range(0, n) range 0 n for j in range(0, m):
        if list_ans[j] not in list_a[i][1:]:
            list_ans[j] = '0' j range(0, m) range 0 m if list_ans[j] not in list_a[i][1:]:
            list_ans[j] = '0' list_ans[j] not in list_a[i][1:] list_ans[j] list_ans j list_a[i][1:] [i] list_a i 1: 1 list_ans[j] = '0' list_ans[j] list_ans j '0' s for s in list_ans if s != '0' for s in list_ans if s != '0' s list_ans s != '0' s '0' if s != '0' s print(len([s for s in list_ans if s != '0'])) print len([s for s in list_ans if s != '0']) len [s for s in list_ans if s != '0'] m = [int(i) for i in input().split()] [int(i) for i in input().split()] m n, m = [int(i) for i in input().split()] [int(i) for i in input().split()] n list_a = [[s for s in input().split()] for i in range(0, n)] [[s for s in input().split()] for i in range(0, n)] list_a list_ans = [str(s) for s in range(1, m + 1)] [str(s) for s in range(1, m + 1)] list_ans
n, m = [int(i) for i in input().split()]
list_a = [[s for s in input().split()] for i in range(0, n)]
list_ans = [str(s) for s in range(1, m + 1)]
for i in range(0, n):
    for j in range(0, m):
        if list_ans[j] not in list_a[i][1:]:
            list_ans[j] = '0'
print(len([s for s in list_ans if s != '0']))