#include using namespace std; int main() { int N, K; cin >> N >> K; if(N - 1 == K || K == 1) { cout << "No"; return 0; } if((N - 1) % K == 0) { if(K == 2) { cout << "No" << "\n"; return 0; } cout << "Yes" << "\n"; for(int i = 0; i < K - 1; i++) { cout << i + 1 << " " << i + 2 << " "; if(i == K - 2) { cout << -5001*(K - 1) - 1 << "\n"; } else { cout << 5001 << "\n"; } } for(int i = K - 1; i < N - 1; i++) { cout << K << " " << i + 2 << " "; cout << 5001 << "\n"; } } else { cout << "Yes" << "\n"; for(int i = 0; i < N - 1; i++) { cout << i + 1 << " " << i + 2 << " "; if(i%K == K - 1) { cout << -5001*(K - 1) - 1 << "\n"; } else { cout << 5001 << "\n"; } } } }