#include <stdio.h>
int cnt[10010];
int main() {
int n, m, val=0;
scanf("%d %d", &n, &m);
for(int i=0; i<n; i++) {
for(int j=0; j<m; j++) {
int a;
scanf("%d", &a);
cnt[a]++;
}
}
for(int i=1; i<10001; i++) {
if(cnt[i]%2) val++;
}
printf("%d ", val);
if(m==1) printf("YES");
else if(m%2) {
if(val>m) printf("NO");
else printf("YES");
}
else {
if(val) printf("NO");
else printf("YES");
}
}
/*
5 5
3 5 9 2 5
9 6 3 5 7
5 3 6 9 3
2 9 6 3 6
2 3 9 5 2
3 12 9 12 3
9 5 6 9
5 3 6 3 5
9 5 6 5 9
2 3 7 3 2
1 1 0 1 1
*/
To embed this project on your website, copy the following code and paste it into your website's HTML: