#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
const int inf = 1000000009;
int i, j, k, m, n, l;
int ans;
vector<int> adj[100001];
int p[100001];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) p[i] = i;
  for (int u = 1; u <= m; u++) {
    scanf("%d%d", &i, &j);
    while (p[i] != i) i = p[i];
    while (p[j] != j) j = p[j];
    if (i != j && m == n - 1) {
      p[i] = j;
    } else {
      cout << "no" << endl;
      return 0;
    }
  }
  cout << "yes" << endl;
  return 0;
}
