#include <bits/stdc++.h>
using namespace std;
const int maxn = 150500;
vector<int> f[maxn];
int vis[maxn];
void dfs(int n, int &cnt_v, int &cnt_e) {
  if (vis[n]) return;
  vis[n] = 1;
  cnt_v++;
  cnt_e += f[n].size();
  for (vector<int>::iterator it = f[n].begin(); it != f[n].end(); it++) {
    if (!vis[*it]) {
      dfs(*it, cnt_v, cnt_e);
    }
  }
}
int main() {
  int n, m, a, b;
  cin >> n >> m;
  while (m--) {
    cin >> a >> b;
    f[a].push_back(b);
    f[b].push_back(a);
  }
  memset(vis, 0, sizeof(vis));
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) {
      int cnt_v = 0, cnt_e = 0;
      dfs(i, cnt_v, cnt_e);
      if (cnt_e != (long long)cnt_v * (cnt_v - 1)) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}
