#include <bits/stdc++.h>   using namespace std;   const int N = 150005;   int n, m;   int a, b;   vector<int> g[N];   bool pos[N];   vector<int> dsu;   bool rez;   bool proveri() {     for (int u = 0; u < dsu.size(); u++)       if (g[dsu[u]].size() != dsu.size() - 1) return false;     return true;   }   void dfs(int cvor) {     pos[cvor] = true;     dsu.push_back(cvor);     for (int v = 0; v < g[cvor].size(); v++)       if (!pos[g[cvor][v]]) dfs(g[cvor][v]);   }   void DFS() {     for (int u = 1; u <= n && !rez; u++) {       if (!pos[u]) {         dsu.clear();         dfs(u);         if (!proveri()) rez = true;       }     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cin >> n >> m;     for (int i = 1; i <= m; i++) {       cin >> a >> b;       g[a].push_back(b);       g[b].push_back(a);     }     DFS();     if (rez == true)       cout <<  NO  << endl;     else       cout <<  YES  << endl;     return 0;   }   