#include <iostream>
#include <vector>
using namespace std;
int main() {
int m,n,f,l; bool p=true;
cin>>n>>m;
vector <int> a(n);
for (int i=0; i<m; i++){
cin>>f>>l;
a[f-1]++; a[l-1]++;
}
for (int i=0; i<n; i++){if (a[i]!=a[0]){p=false; break;}}
if (p) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQgbSxuLGYsbDsgYm9vbCBwPXRydWU7CgljaW4+Pm4+Pm07Cgl2ZWN0b3IgPGludD4gYShuKTsKCWZvciAoaW50IGk9MDsgaTxtOyBpKyspewoJCWNpbj4+Zj4+bDsKCQlhW2YtMV0rKzsgYVtsLTFdKys7Cgl9Cglmb3IgKGludCBpPTA7IGk8bjsgaSsrKXtpZiAoYVtpXSE9YVswXSl7cD1mYWxzZTsgYnJlYWs7fX0KCWlmIChwKSBjb3V0PDwiWUVTIjw8ZW5kbDsKCWVsc2UgY291dDw8Ik5PIjw8ZW5kbDsKfQ==