#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
long long dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
long long dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
long long expo(long long x, long long y) {
  long long res = 1;
  x = x % M;
  while (y > 0) {
    if (y & 1) res = (1ll * res * x) % M;
    y = y >> 1;
    x = (1ll * x * x) % M;
  }
  return res;
}
long long parent[200005];
long long size[200005];
bool flag = true;
long long find(long long x) {
  if (parent[x] == x) return x;
  return parent[x] = find(parent[x]);
}
void uni(long long x, long long y) {
  long long px = find(x);
  long long py = find(y);
  if (px != py) {
    if (size[px] > size[py]) swap(px, py);
    parent[px] = py;
    size[py] += size[px];
  } else
    flag = false;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t = 1;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    for (long long i = 1; i <= n; i++) {
      size[i] = 1;
      parent[i] = i;
    }
    while (m--) {
      long long x, y;
      cin >> x >> y;
      uni(x, y);
    }
    long long temp = find(1);
    for (long long i = 1; i <= n; i++) {
      if (find(i) != temp) {
        flag = false;
        break;
      }
    }
    if (flag)
      cout << "yes\n";
    else
      cout << "no\n";
  }
  return 0;
}
