#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-12;
const double pi = 3.141592653589793;
const int N = 1e6 + 5;
const int mod = 1e9 + 7;
bool vis[N];
int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
long long n, m, cnt, edges;
vector<vector<int> > g;
string ans = "yes";
void dfs(int curr, int par) {
  if (vis[curr]) return;
  cnt++;
  edges += ((int)((g[curr]).size()));
  vis[curr] = 1;
  for (int x : g[curr]) {
    if (x != par) {
      dfs(x, curr);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  g.resize(n + 1);
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    g[a].push_back(b);
    swap(a, b);
    g[a].push_back(b);
  }
  for (int i = 1; i <= n; ++i) {
    if (!vis[i]) {
      cnt = 0;
      edges = 0;
      dfs(i, -1);
      if (cnt > 2 && (edges / 2) != (cnt * (cnt - 1) / 2)) {
        ans = "no";
        break;
      }
    }
  }
  cout << ans;
}
