fun main(args: Array) { val (ws, n) = readLine()!!.split(" ").map { it.toInt() } val xs = (1..ws).map { 0 }.toMutableList() var check = false for( nn in (1..n) ) { readLine()!!.split(" ").map { it.toInt() }.mapIndexed { index, x -> xs[index] += x if( check == false ) { scan@for( s in (0..xs.size-1) ) { for( e in (s..xs.size-1) ) { if( xs.slice(s..e).sum() == 777) { check = true continue@scan } } } } } } if(check) println("YES") else println("NO") }