#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  {
    long long n, m, i;
    cin >> n >> m;
    vector<long long> adj[n + 1];
    for (i = 0; i < m; i++) {
      long long u, v;
      cin >> u >> v;
      adj[u].push_back(v);
      adj[v].push_back(u);
    }
    long long f1 = 0;
    for (long long i = 1; i <= n; i++) {
      adj[i].push_back(i);
      sort(adj[i].begin(), adj[i].end());
    }
    for (i = 1; i <= n; i++) {
      for (auto it : adj[i]) {
        if (adj[i] != adj[it]) {
          cout << "NO";
          return 0;
        }
      }
    }
    cout << "YES";
  }
}
