import sys input = sys.stdin.buffer.readline def main(): N,K = map(int,input().split()); MAX = pow(10,9) if N - 1 == K: print("No");exit() if K == 1: print("No");exit() if K == 2: if N%2 == 0: print("Yes") x = MAX - 1 for i in range(N-1): v = i+1; u = i+2 if i%2 == 0: ret = [v,u,x] print(*ret) else: ret = [v,u,-MAX] print(*ret) 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()