#include<bits/stdc++.h> #define int long long using namespace std; constexpr int BASE=100000; signed main(){ int N,K; cin>>N>>K; if(K==N-1 || K==1)return puts("No"),0; if(K==2 && N%2==1)return puts("No"),0; puts("Yes"); if(K==2){ for(int i=0;i<N-1;i++){ if(i%2==0)cout<<i+1<<' '<<i+2<<' '<<BASE-1<<endl; else cout<<i+1<<' '<<i+2<<' '<<-BASE<<endl; } }else{ for(int i=0;i<K;i++){ if(i==0)cout<<i+1<<' '<<i+2<<' '<<BASE*(K-1)-1<<endl; else cout<<i+1<<' '<<i+2<<' '<<-BASE<<endl; } for(int i=K;i<N-1;i++)cout<<K+1<<' '<<i+2<<' '<<' '<<BASE*(K-1)-1<<endl; } }