#include<iostream>
#include<algorithm>
using namespace std;
const int N= 110;
int f[N];
int find(int x)
{
if (f[x] != x) f[x] = find(f[x]);
return f[x];
}
int main()
{
int n,m;
cin>>n>>m;
int a,b;
for(int i=1;i<=n;i++)
{
f[i]=i;
}
int cnt = n;
for(int i=0;i<m;i++)
{
cin>>a>>b;
if(find(b)!=find(a))
{
f[find(b)] = find(a);
cnt--;
}
}
if(cnt==1 && n==m) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
return 0;
}