#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> A;
  A.resize(n + 1);
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    A[a].push_back(b);
    A[b].push_back(a);
  }
  if (m != n - 1) {
    cout << "no" << endl;
    return 0;
  }
  int u, v;
  vector<bool> visited(n + 1);
  stack<int> S;
  S.push(1);
  while (!S.empty()) {
    u = S.top();
    S.pop();
    if (!visited[u]) {
      visited[u] = true;
      for (int i = 0; i < A[u].size(); i++) {
        if (!visited[A[u][i]]) {
          S.push(A[u][i]);
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    if (!visited[i]) {
      cout << "no" << endl;
      return 0;
    }
  }
  cout << "yes" << endl;
}
