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