#include <bits/stdc++.h>
using namespace std;
bool vis[200000];
vector<int> arr[200000];
long long cnt1;
long long cnt2;
void dfs(int v) {
  vis[v] = true;
  cnt1 += arr[v].size();
  cnt2++;
  for (int i = 0; i < arr[v].size(); i++) {
    int child = arr[v][i];
    if (vis[child]) continue;
    dfs(child);
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    arr[x].push_back(y);
    arr[y].push_back(x);
  }
  for (int i = 1; i <= n; i++)
    if (!vis[i]) {
      cnt1 = 0, cnt2 = 0;
      dfs(i);
      if ((cnt1 / 2) < (cnt2 * (cnt2 - 1)) / 2) return cout << "NO", 0;
    }
  cout << "YES";
}
