#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  map<int, vector<int>> mappu;
  cin >> n >> m;
  for (long long i = (0); i < (m); i++) {
    int a, b;
    cin >> a >> b;
    mappu[a].push_back(b);
    mappu[b].push_back(a);
  }
  for (long long i = (1); i < (n + 1); i++) {
    mappu[i].push_back(i);
    sort(mappu[i].begin(), mappu[i].end());
  }
  for (long long i = (1); i < (n + 1); i++) {
    for (long long j = (0); j < (mappu[i].size()); j++) {
      if (mappu[i] != mappu[mappu[i][j]]) {
        cout << "NO";
        return 0;
      }
    }
  }
  cout << "YES";
}
