import sys input = sys.stdin.buffer.readline def main(): N,K = map(int,input().split()); MAX = 8*pow(10,8) if N - 1 == K: print("No");exit() if K == 2: if N == 4: print("Yes") print("1 2 2");print("2 3 -3");print("3 4 2") else: print("No") exit() print("Yes") x = MAX//(K-1) for i in range(K-1): v = i+1; u = i+2 ret = [v,u,-x] print(*ret) s = u+1 y = x*(K-1) - 1 while s <= N: ret = [u,s,y] print(*ret) s += 1 if __name__ == '__main__': main()