#include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define llong long long int main() { int n, m; cin >> n >> m; bool flg = false; vector p(n, 0); rep(i, m) { rep(i, n) { int a; cin >> a; p[i] += a; } if(!flg) { int people = 0; int startidx = 0; rep(i, n) { while(people > 777) { people -= p[startidx]; startidx++; } people += p[i]; if(people == 777) { flg = true; break; } } } } cout << (flg ? "YES" : "NO") << "\n"; }