#include <bits/stdc++.h>
using namespace std;
void in() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
}
const int INF = 1e9;
long long mpi(long long a, long long b, long long c) {
  long long ans = 1;
  while (b != 0) {
    if (b % 2 == 1) ans = (ans * a) % c;
    a = (a * a) % c;
    b /= 2;
  }
  return a;
}
vector<long long> v1[150005], v2[150005], v3;
set<long long> s1, s2;
bool vis[150005];
void dfs(long long k, long long &edges, long long &vertices) {
  vis[k] = true;
  ++vertices;
  edges += v1[k].size();
  for (long long z : v1[k]) {
    if (!vis[z]) dfs(z, edges, vertices);
  }
}
int main() {
  in();
  long long n, m, a, b;
  cin >> n >> m;
  for (long long i = 0; i < m; i++) {
    cin >> a >> b;
    v1[a].push_back(b);
    v1[b].push_back(a);
  }
  for (long long i = 1; i <= n; i++) {
    if (!vis[i]) {
      long long vertices = 0;
      long long edges = 0;
      dfs(i, edges, vertices);
      if (edges != vertices * (vertices - 1)) {
        cout << "NO";
        return 0;
      }
    }
  }
  cout << "YES";
  return 0;
}
