A new computer virus has been discovered, and you want to build a vaccine program to remove it. To build the vaccine you must know the virus code: the part that appears in common across all infected programs is suspected to be the virus. Each program's code is represented as a sequence of positive integers.
To avoid detection, the virus may insert its code in reverse. Therefore a code and its reversal are treated as the same virus code — for example, one program may contain it as A B C D while another contains it as D C B A.
Because parts of two programs' codes may match by coincidence, a common code is only suspected to be the virus when its length is at least K.
Given N infected programs, write a program that decides whether there exists a contiguous code fragment of length at least K that appears (forward or reversed) in every one of the programs.
The first line contains the number of infected programs N and the minimum length K required to suspect a virus code. (2≤N≤100, 4≤K≤1,000)
From the second line, the information for each program is given in order. For each program, its code length Mi is given on one line, and the next line contains the Mi positive integers that make up the program's code, separated by spaces. (10≤Mi≤1,000, and each integer is between 1 and 10,000 inclusive.)
Print YES if a suspected virus code exists in all programs, and NO otherwise.