w_max = 1500 n, k = map(int, input().split()) if k == 1 or k == n - 1: exit(print("No")) if k == 2: if n % 2: exit(print("No")) print("Yes") for i in range(n - 1): if i % 2: print(i + 1, i + 2, -w_max) else: print(i + 1, i + 2, w_max - 1) exit() if k == 3 and n == 5: print("Yes") print(1, 2, -2) print(2, 3, -1) print(3, 4, 2) print(3, 5, 2) exit() if k == n - 2: print("Yes") for i in range(k - 1): print(i + 1, i + 2, 1) print(k, k + 1, -k) print(3, n, 2) exit() if 3 <= k <= n - 3: print("Yes") for i in range(k - 2): print(i + 1, i + 2, 1) print(k - 1, k, -k) for i in range(n - k): print(k, k + i + 1, 1) exit()