## https://yukicoder.me/problems/no/1523 def main(): N, K = map(int, input().split()) if K == 1 or K == N - 1: print("No") return if K == 2: if N % 2 == 0: n = (N - 1) // 2 print("Yes") for i in range(N - 1): a = i + 1 b = i + 2 if i % 2 == 0: w = (n + 1) else: w = -(n + 2) print(a, b, w) return else: print("No") return else: print("Yes") nega = 2 * (K - 1) + 1 nega = -nega print(1, 2, nega) for i in range(2, 2 + (K - 1)): print(i, i + 1, 2) for i in range(2 + (K - 1), N): print(K, i + 1, 2) if __name__ == '__main__': main()