class Proc { public func doProc() { let inpt = readLine()!.split(separator: " ").map{ Int($0)! } let cargoCount = inpt[0] let stCount = inpt[1] var cargo = (0.. 777 { from = j + 1 total = 0 } else { total += cargo[j] while total > 777 { total -= cargo[from] from += 1 } } isValid = isValid || total == 777 } } var ans = "NO" if isValid { ans = "YES" } print(ans) } } Proc().doProc()