import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; Scanner in = new Scanner(inputStream); PrintWriter out = new PrintWriter(outputStream); TaskG solver = new TaskG(); solver.solve(1, in, out); out.close(); } static class TaskG { public void solve(int testNumber, Scanner in, PrintWriter out) { int n = in.nextInt(); int m = in.nextInt(); long a[][] = new long[m][n]; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { a[i][j] = in.nextLong(); if (i != 0) { a[i][j] += a[i - 1][j]; } } if (ok(a, n, i)) { out.println("YES"); return; } } out.println("NO"); } private boolean ok(long[][] a, int n, int i) { int l = 0; long sum = 0; for (int r = 0; r < n; r++) { if (sum == 777) return true; if (a[i][r] + sum <= 777) { sum += a[i][r]; } else { while (sum + a[i][r] > 777) { sum -= a[i][l]; l++; } sum += a[i][r]; if (l > r) r++; } } if (sum == 777) return true; return false; } } }