#include #define INF 1000000000000000007 #define rep(i, N) for(ll i = 0; i < N; i++) #define rep2(i, j, k) for(ll i = j; i < k; i++) #define chmax(x, y) x = max(x, y) #define chmin(x, y) x = min(x, y) #define print(x) cout << x << "\n" #define print2(x, y) cout << x << " " << y << "\n" #define printv(vec){for(auto p: vec) cout << p << " "; cout << "\n";} #define SUM(v) accumulate(v.begin(), v.end(), 0LL) #define MAX(v) *max_element(v.begin(), v.end()) #define MIN(v) *min_element(v.begin(), v.end()) #define SORT(v) sort(v.begin(), v.end()) #define REV(v) reverse(v.begin(), v.end()) #pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") typedef long long ll; using namespace std; using vl = vector; using vvl = vector>; void Main(){ // ll n, k; // cin >> n >> k; // vvl v(k, vl(2)); // rep(i, k) cin >> v[i][0] >> v[i][1]; ll n, m; cin >> n >> m; vl f(n); rep(i, m){ rep(i, n){ ll in; cin >> in; f[i] += in; } ll r = 0; ll acc = 0; rep(l, n){ while(r < n && acc + f[r] <= 777){ acc += f[r]; r += 1; } if(acc == 777){ print("YES"); return; } if(l == r) r += 1; else acc -= f[l]; } } print("NO"); } int main(){ ios_base::sync_with_stdio(false); cin.tie(0); ll t = 1; // cin >> t; rep(i, t) Main(); return 0; }