#include <bits/stdc++.h>
using namespace std;
template <class A, class B>
inline bool mina(A &x, const B &y) {
  return (y < x) ? (x = y, 1) : 0;
}
template <class A, class B>
inline bool maxa(A &x, const B &y) {
  return (x < y) ? (x = y, 1) : 0;
}
class UnionFind {
 public:
  int N;
  vector<int> par;
  UnionFind(int n = 0) {
    resize(n);
    reset();
  }
  void resize(int n) {
    N = n;
    par.resize(N);
  }
  void reset() {
    for (int _b = (N), i = (0); i < _b; ++i) par[i] = i;
  }
  int findSet(int a) {
    if (par[a] != a) par[a] = findSet(par[a]);
    return par[a];
  }
  int unionSet(int a, int b) {
    a = findSet(a);
    b = findSet(b);
    if (a == b) return 0;
    par[b] = a;
    return 1;
  }
};
int main() {
  {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
  };
  int N, M;
  cin >> N >> M;
  int v = 1;
  if (N - 1 != M)
    v = 0;
  else {
    UnionFind U(N);
    for (int _n = (M); _n--;) {
      int a, b;
      cin >> a >> b;
      v &= U.unionSet(a - 1, b - 1);
    }
  }
  if (!v)
    cout << "no" << '\n';
  else
    cout << "yes" << '\n';
  return 0;
}
