import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int[][] a = new int[m][n]; int[][] b = new int[m][n]; for(int i = 0; i < m; i++) { for(int j = 0; j < n; j++) { a[i][j] = sc.nextInt(); } } for(int j = 0; j < n; j++) { b[0][j] = a[0][j]; } for(int i = 1; i < m; i++) { for(int j = 0; j < n; j++) { b[i][j] = b[i - 1][j] + a[i][j]; } } String ans = "NO"; int p = 0; for(int i = 0; i < m; i++) { int left = 0; int right = 0; int sum = 0; while(right < n) { sum += b[i][right]; if(sum <= 777) { if(sum == 777) { p++; right++; } else { right++; } } else { sum -= b[i][left]; left++; } } } if(p > 0) ans = "YES"; System.out.println(ans); } }