#include <iostream>
using namespace std;
const int MAX = 111;
char A[MAX][MAX];
int R[MAX];
int C[MAX];
int main(int argc, char* argv[])
{
int n, m;
scanf("%d%d", &n, &m);
for (int i = 0; i < n; i++)
{
scanf("%s", A[i]);
}
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
if (A[i][j] == '1') R[i] = C[j] = 1;
}
}
int a = 0;
int b = 0;
for (int i = 0; i < n; i++)
{
a += R[i];
}
for (int j = 0; j < m; j++)
{
b += C[j];
}
if (a == n || b == m) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}