#include <bits/stdc++.h>
using namespace std;
int RANK[1001], parent[1001];
int find(int x) {
  if (parent[x] != x) parent[x] = find(parent[x]);
  return parent[x];
}
void merge(int x, int y) {
  x = find(x);
  y = find(y);
  if (RANK[x] == RANK[y]) {
    RANK[x]++;
    parent[y] = x;
    return;
  }
  if (RANK[x] < RANK[y]) {
    parent[x] = y;
    return;
  }
  parent[y] = x;
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    RANK[i] = 1;
    parent[i] = i;
  }
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    if (find(x) == find(y)) {
      cout << "no" << endl;
      return 0;
    }
    merge(x, y);
  }
  for (int i = 2; i <= n; i++)
    if (find(i - 1) != find(i)) {
      cout << "no" << endl;
      return 0;
    }
  cout << "yes" << endl;
  return 0;
}
