#include <bits/stdc++.h>
using namespace std;
vector<int> adj[200005];
float ans = 0;
vector<bool> vis(200005, false);
vector<int> v;
int deg[200005];
int f = 0;
void dfs(int root) {
  vis[root] = true;
  v.push_back(root);
  for (auto x : adj[root]) {
    if (!vis[x]) dfs(x);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int n, ans = 0, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
    deg[x]++;
    deg[y]++;
  }
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) {
      f = 0;
      int s = 0;
      v.clear();
      dfs(i);
      for (int x : v) {
        s += adj[x].size();
      }
      if (s != (long long)v.size() * (v.size() - 1)) {
        f = 1;
        break;
      }
    }
  }
  if (f)
    cout << "No\n";
  else
    cout << "Yes\n";
  return 0;
}
