Vasya wants to turn on Christmas lights consisting of m bulbs. Initially, all bulbs are turned off. There are n buttons, each of them is connected to some set of bulbs. Vasya can press any of these buttons. When the button is pressed, it turns on all the bulbs it's connected to. Can Vasya light up all the bulbs?

If Vasya presses the button such that some bulbs connected to it are already turned on, they do not change their state, i.e. remain turned on.


-----Input-----

The first line of the input contains integers n and m (1 ≤ n, m ≤ 100) — the number of buttons and the number of bulbs respectively. 

Each of the next n lines contains x_{i} (0 ≤ x_{i} ≤ m) — the number of bulbs that are turned on by the i-th button, and then x_{i} numbers y_{ij} (1 ≤ y_{ij} ≤ m) — the numbers of these bulbs.


-----Output-----

If it's possible to turn on all m bulbs print "YES", otherwise print "NO".


-----Examples-----
Input
3 4
2 1 4
3 1 3 1
1 2

Output
YES

Input
3 3
1 1
1 2
1 1

Output
NO



-----Note-----

In the first sample you can press each button once and turn on all the bulbs. In the 2 sample it is impossible to turn on the 3-rd lamp.

Difficulty: interview

Starter code:

Solutions:
n, m = [int(i) for i in input().split()]
d = set()
for i in range(n):
	_, *a = [int(i) for i in input().split()]
	d |= set(a)

if len(d) == m:
	print("YES")
else:
	print("NO")


n, m = list(map(int, input().split()))
p = [0] * m
for i in range(n):
    a = list(map(int, input().split()))
    for t in range(1, len(a)):
        p[a[t] - 1] = 1
if min(p) == 0:
    print('NO')
else:
    print('YES')


n, m = list(map(int, input().split()))

bulbs = set(range(1, m+1))

for _ in range(n):
    count, *numbers = list(map(int, input().split()))
    for number in numbers:
        bulbs -= { number }

if len(bulbs) > 0:
    print("NO")
else:
    print("YES")


#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 missingdays <missingdays@missingdays>
#
# Distributed under terms of the MIT license.

"""

"""

[n, m] = list(map(int, input().split()))

l = [0 for i in range(m)]

for i in range(n):
    a = list(map(int, input().split()))

    for i in range(1, a[0]+1):
        l[a[i]-1] = True

if(all(l)):
    print("YES")
else:
    print("NO")


n, m = [int(x) for x in input().split()]
b = [False] * m
for _ in range(n):
    for y in [int(x) for x in input().split()][1:]:
        b[y-1] = True

if all(b):
    print("YES")
else:
    print("NO")


n,m = list(map(int,input().split()))

arr = []

for i in range(n):
    bulbs = list(map(int,input().split()))
    bulbs = bulbs[1:]
    arr.extend(bulbs)

if len(set(arr)) == m:
    print('YES')
else:
    print('NO')


n, m = map(int, input().split())
s = set()
for i in range(n):
    a = list(map(int, input().split()))
    a = a[1:]
    s |= set(a)
if len(s) == m:
    print("YES")
else:
    print("NO")

n, m = [int(x) for x in input().split()]
S = set()
for i in range(n):
    S.update({int(x) for x in input().split()[1:]})

print('YES' if S == set(range(1,m+1)) else 'NO')


n, m = list(map(int, input().split()))
s = set()
for i in range(n):
    x, *l = list(map(int, input().split()))
    for y in l:
        s.add(y)
if len(s) == m:
    print("YES")
else:
    print("NO")




n, m = map(int, input().strip().split())

on = set()

for _ in range(n):
    on|= set((list(map(int, input().strip().split())))[1:])

if len(on) == m:
    print("YES")
else:
    print("NO")

n,m = input().split()
n = int(n)
m = int(m)

l = set()
for i in range(n):
    ll = list(map(int, input().split()))
    for j in ll[1:]:
        l.add(j)
if len(l) == m:
    print('YES')
else:
    print('NO')


n, m = list(map(int, input().split()))
used = [False for i in range(m)]
for i in range(n):
    amount, *lamps = list(map(int, input().split()))
    for lamp in lamps:
        used[lamp - 1] = True
if sum(used) == len(used):
    print("YES")
else:
    print("NO")



n, m = [int(x) for x in input().split()]
used = [False] * m
for i in range(n):
    s = [int(x) for x in input().split()]
    num = s.pop(0)
    for elem in s:
        used[elem - 1] = True
for elem in used:
    if not elem:
        print('NO')
        break
else:
    print('YES')

import sys
if False:
	inp = open('A.txt', 'r')
else:
	inp = sys.stdin

n, m = map(int, inp.readline().split())
bulbs = []
for i in range(n):
	bulbs += list(map(int, inp.readline().split()))[1:]
bulbs = set(bulbs)
if len(bulbs) == m:
	print('YES')
else:
	print('NO')

m,n=[int(x) for x in input().split()]
s=set()
for i in range(m):
    L=[int(x) for x in input().split()]
    for i in range(1,len(L)):
        s.add(L[i])
if len(s)==n:
    print('YES')
else:
    print('NO')


#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import time


(n, m) = (int(i) for i in input().split())

a = [ 0 for i in range(m) ]

for i in range(n):
    b   = [int(i) for i in input().split()]
    for j in b[1:]:
        a[j-1] = 1

start = time.time()

if 0 in a:
    print('NO')
else:
    print('YES')

finish = time.time()
#print(finish - start)


n, m = map(int, input().split())
data = []
used = [False for i in range(m)]
for i in range(n):
    help = list(map(int, input().split()))
    help = help[1:]
    for elem in help:
        used[elem - 1] = True
if False in used:
    print("NO")
else:
    print("YES")

__author__ = 'MoonBall'

import sys
# sys.stdin = open('data/A.in', 'r')
T = 1

def process():
    N, M = list(map(int, input().split()))
    f = [0] * (M + 1)
    for _ in range(N):
        a = list(map(int, input().split()))
        for i in range(a[0]): f[a[i + 1]] = 1

    print('YES' if sum(f) == M else 'NO')






for _ in range(T):
    process()


#!/bin/python3

(n, m) = input().split()
(n, m) = (int(n), int(m))

s = set()

for a in range(n):
    s |= set(input().split()[1:])

for b in range(m):
    if str(b+1) in s:
        continue
    else:
        print("NO")
        quit()

print("YES")


n, m = [int(x) for x in input().split()]
v = [0] * 101
for _ in range(n):
    curr = [int(x) for x in input().split()][1:]
    for x in curr:
        v[x] = 1

correct = True
for x in range(1, m+1):
    if not v[x]:
        correct = False
        break

if correct:
    print("YES")
else:
    print("NO")


n, m = input().split()
n = int(n)
m = int(m)
s = set()
for x in range(n):
    a = input().split()
    for y in a[1:]:
        s.add(int(y))
print("YES" if len(s) == m else "NO")


n, m = map(int, input().split())

state = [False] * m
count = 0
for i in range(n):
    for lamp in tuple(map(int, input().split()))[1:]:
        if not state[lamp - 1]:
            state[lamp-1] = True
            count += 1

print("YES" if count == m else "NO")

n, m = list(map(int, input().split()))
lst = [False] * m
for i in range(n):
    k = list(map(int, input().split()))
    for i in range(1, len(k)):
        lst[k[i] - 1] = True
    
for i in lst:
    if i == False:
        print('NO')
        break
else:
    print('YES')


n,m = list(map(int, input().split()))
b = [None] + [False for i in range(m)]
for i in range(n):
    a,*q = list(map(int, input().split()))
    for e in q:
        b[e] = True
T = True
for i in b[1:]:
    T = T and i
print("YES" if T else "NO")


n, m = map(int, input().split())
isen = []
for i in range(m):
    isen.append(0)
for i in range(n):
    a = input().split()
    k = int(a[0])
    for j in range(k):
        cur = int(a[j + 1])
        isen[cur - 1] = 1
ok = True
for i in isen:
    if i == 0:
        ok = False
if ok:
    print("YES")
else:
    print("NO")