#include using namespace std; int b[1001]; int main() { int n, m, a[1001], ans = 0, s = 1; cin >> n >> m; for (int i = 1; i <= m; i++) { for (int j = 1; j <= n; j++) { cin >> a[j]; b[j] += a[j]; } for (int j = 1; j <= n; j++) { ans += b[j]; if (ans > 777) { while (ans > 777) { ans -= b[s]; s++; } } if (ans == 777) { cout << "YES" << endl; return 0; } } s = 1; ans = 0; } cout << "NO" << endl; }