#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const int MAXN = 1500907;
vector<vector<long long>> adj;
bool visited[MAXN];
long long n_nodes;
long long n_edges;
void dfs(int node) {
  visited[node] = 1;
  n_nodes++;
  for (auto i : adj[node]) {
    n_edges++;
    if (!visited[i]) {
      dfs(i);
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m, a, b;
  cin >> n >> m;
  adj.resize(n + 5);
  while (m--) {
    cin >> a >> b;
    a--;
    b--;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  for (long long i = 1; i <= n; i++) {
    if (!visited[i]) {
      n_nodes = 0;
      n_edges = 0;
      dfs(i);
      if (n_edges != n_nodes * (n_nodes - 1)) {
        cout << "NO" << endl;
        return 0;
      }
    }
  }
  cout << "YES" << endl;
  return 0;
}
