You are given two positive integers $n$ ($1 \le n \le 10^9$) and $k$ ($1 \le k \le 100$). Represent the number $n$ as the sum of $k$ positive integers of the same parity (have the same remainder when divided by $2$).

In other words, find $a_1, a_2, \ldots, a_k$ such that all $a_i>0$, $n = a_1 + a_2 + \ldots + a_k$ and either all $a_i$ are even or all $a_i$ are odd at the same time.

If such a representation does not exist, then report it.


-----Input-----

The first line contains an integer $t$ ($1 \le t \le 1000$) — the number of test cases in the input. Next, $t$ test cases are given, one per line.

Each test case is two positive integers $n$ ($1 \le n \le 10^9$) and $k$ ($1 \le k \le 100$).


-----Output-----

For each test case print:

  YES and the required values $a_i$, if the answer exists (if there are several answers, print any of them);  NO if the answer does not exist. 

The letters in the words YES and NO can be printed in any case.


-----Example-----
Input
8
10 3
100 4
8 7
97 2
8 8
3 10
5 3
1000000000 9

Output
YES
4 2 4
YES
55 5 5 35
NO
NO
YES
1 1 1 1 1 1 1 1
NO
YES
3 1 1
YES
111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120

Difficulty: EASY
Tags: Mathematics

Constructive algorithms

Starter code:

Solutions:
t = int(input())
while t > 0:
	nk = input()
	n = int(nk.split()[0])
	k = int(nk.split()[1])
	result = []
	if n % 2 == 0 and k * 2 <= n:
		print('YES')
		for x in range(k):
			result.append(2)
		result[0] = result[0] + n - k * 2
		for x in result:
			print(x, end=' ')
		print()
	elif n % 2 == 0 and k % 2 == 0 and (k <= n):
		print('YES')
		for x in range(k):
			result.append(1)
		result[0] = result[0] + n - k
		for x in result:
			print(x, end=' ')
		print()
	elif n % 2 != 0 and k * 1 <= n and (k % 2 != 0):
		print('YES')
		for x in range(k):
			result.append(1)
		result[0] = result[0] + n - k
		for x in result:
			print(x, end=' ')
		print()
	else:
		print('NO')
	t = t - 1


from sys import stdin, stdout
testcase = int(stdin.readline())
import math
while testcase > 0:
	(n, k) = map(int, stdin.readline().split())
	if n < k:
		print('NO')
	elif n % 2:
		if k % 2 == 0:
			print('NO')
		else:
			print('YES')
			for i in range(k - 1):
				print('1 ', end=' ')
			print(n - k + 1)
	elif n == k:
		print('YES')
		for i in range(k):
			print('1 ', end=' ')
		print()
	elif k % 2 == 0:
		print('YES')
		for i in range(k - 1):
			print('1 ', end=' ')
		print(n - 1 * (k - 1))
	elif k > n // 2:
		print('NO')
	else:
		print('YES')
		for i in range(k - 1):
			print('2 ', end=' ')
		print(n - 2 * (k - 1))
	testcase -= 1


import sys
import os
from math import sqrt, log, log2, log10, gcd, floor, pow, sin, cos, tan, pi, inf, factorial
from copy import copy, deepcopy
from sys import exit, stdin, stdout
from collections import Counter, defaultdict, deque
from itertools import permutations
import heapq
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
mod = 1000000007
iinp = lambda : int(sys.stdin.readline())
inp = lambda : sys.stdin.readline().strip()
strl = lambda : list(inp().strip().split(' '))
intl = lambda : list(map(int, inp().split(' ')))
mint = lambda : map(int, inp().split())
flol = lambda : list(map(float, inp().split(' ')))
flush = lambda : stdout.flush()

def permute(nums):

	def fun(arr, nums, cur, v):
		if len(cur) == len(nums):
			arr.append(cur.copy())
		i = 0
		while i < len(nums):
			if v[i]:
				i += 1
				continue
			else:
				cur.append(nums[i])
				v[i] = 1
				fun(arr, nums, cur, v)
				cur.pop()
				v[i] = 0
				i += 1
		return arr
	res = []
	nums.sort()
	v = [0] * len(nums)
	return fun(res, nums, [], v)

def subsets(res, index, arr, cur):
	res.append(cur.copy())
	for i in range(index, len(arr)):
		cur.append(arr[i])
		subsets(res, i + 1, arr, cur)
		cur.pop()
	return res

def sieve(N):
	root = int(sqrt(N))
	primes = [1] * (N + 1)
	(primes[0], primes[1]) = (0, 0)
	for i in range(2, root + 1):
		if primes[i]:
			for j in range(i * i, N + 1, i):
				primes[j] = 0
	return primes

def bs(arr, l, r, x):
	if x < arr[0] or x > arr[len(arr) - 1]:
		return -1
	while l <= r:
		mid = l + (r - l) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return -1

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	p = int(sqrt(n))
	for i in range(5, p + 1, 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	return True

def solve():
	(n, k) = mint()
	if n - k + 1 > 0 and n - k + 1 & 1:
		print('YES')
		ans = []
		for i in range(k - 1):
			ans.append(1)
		ans.append(n - k + 1)
		print(*ans)
	elif n - 2 * (k - 1) > 0 and (n - 2 * (k - 1)) % 2 == 0:
		print('YES')
		ans = []
		for i in range(k - 1):
			ans.append(2)
		ans.append(n - 2 * (k - 1))
		print(*ans)
	else:
		print('NO')
for _ in range(iinp()):
	solve()


def solve(n, k):
	res = []
	if n % 2 == 0 and k % 2 == 0:
		if n < k:
			return res
		elif n < 2 * k:
			res.extend([1] * (k - 1))
			res.append(n - 1 * (k - 1))
			return res
		else:
			res.extend([2] * (k - 1))
			res.append(n - 2 * (k - 1))
			return res
	elif n % 2 == 0 and k % 2 != 0:
		if n < 2 * k:
			return res
		else:
			res.extend([2] * (k - 1))
			res.append(n - 2 * (k - 1))
			return res
	elif n % 2 == 1 and k % 2 == 0:
		return res
	elif n < k:
		return res
	else:
		res.extend([1] * (k - 1))
		res.append(n - 1 * (k - 1))
		return res
t = int(input())
for i in range(0, t):
	(n, k) = map(int, input().split())
	res = solve(n, k)
	if len(res) == 0:
		print('NO')
	else:
		print('YES')
		print(' '.join(map(str, res)))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	for i in [1, 2]:
		if k * i <= n and k * i % 2 == n % 2:
			print('YES\n' + (str(i) + ' ') * (k - 1) + str(n - i * (k - 1)))
			break
	else:
		print('NO')


T = int(input())
for tt in range(T):
	(n, k) = [int(i) for i in input().split()]
	nechet = (k - 1) * 1 + n - (k - 1)
	chet = (k - 1) * 2 + n - (k - 1) * 2
	if nechet == n and n - (k - 1) > 0 and (n - (k - 1)) % 2:
		print('YES')
		print('1 ' * (k - 1) + str(n - (k - 1)))
	elif chet == n and n - 2 * (k - 1) > 0 and ((n - 2 * (k - 1)) % 2 == 0):
		print('YES')
		print('2 ' * (k - 1) + str(n - 2 * (k - 1)))
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	flag = True
	if n % 2 == 1:
		if n < k or k % 2 == 0:
			flag = False
		else:
			ans = [1] * (k - 1)
			s = n - sum(ans)
			ans.append(s)
	elif k % 2 == 1:
		if n < 2 * k:
			flag = False
		else:
			ans = [2] * (k - 1)
			s = n - sum(ans)
			ans.append(s)
	elif n < k:
		flag = False
	else:
		ans = [1] * (k - 1)
		s = n - sum(ans)
		ans.append(s)
	if flag:
		print('YES')
		print(*ans)
	else:
		print('NO')


a = int(input())
for ifei in range(a):
	vals = input().split()
	vals = [int(i) for i in vals]
	n = vals[0]
	k = vals[1]
	if n < k or (n % 2 == 1 and k % 2 == 0):
		print('NO')
	elif k % 2 == 0:
		count = k - 1
		n = n - count
		if n != 0:
			print('YES')
			print('1 ' * count + str(n))
	elif n % 2 == 0:
		if n / 2 >= k:
			print('YES')
			print('2 ' * (k - 1) + str(n - 2 * (k - 1)))
		else:
			print('NO')
	else:
		print('YES')
		print('1 ' * (k - 1) + str(n - 1 * (k - 1)))


T = int(input())
for _ in range(0, T):
	(n, k) = map(int, input().split())
	if n % 2 != 0 and k % 2 == 0:
		print('NO')
	elif n % 2 != 0 and k % 2 != 0:
		L = []
		for i in range(k - 1):
			L.append(1)
		if n - k + 1 > 0:
			L.append(n - k + 1)
			print('YES')
			print(*L)
		else:
			print('NO')
	elif n % 2 == 0 and k % 2 == 0:
		L = []
		for i in range(k - 1):
			L.append(1)
		if n - k + 1 > 0:
			L.append(n - k + 1)
			print('YES')
			print(*L)
		else:
			print('NO')
	elif n % 2 == 0 and k % 2 != 0:
		L = []
		for i in range(k - 1):
			L.append(2)
			n -= 2
		if n > 0:
			L.append(n)
			print('YES')
			print(*L)
		else:
			print('NO')


tc = int(input())
while tc:
	(num, k) = map(int, input().split())
	if (num - (k - 1)) % 2 == 1 and num - (k - 1) > 0:
		print('YES')
		for ik in range(k - 1):
			print('1', end=' ')
		print(num - (k - 1))
	elif (num - 2 * (k - 1)) % 2 == 0 and num - 2 * (k - 1) > 1:
		print('YES')
		for jk in range(k - 1):
			print('2', end=' ')
		print(num - 2 * (k - 1))
	else:
		print('NO')
	tc -= 1


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	(n, k) = map(int, sys.stdin.readline().split())
	cal1 = 0
	cal2 = 0
	result = False
	for _ in range(k - 1):
		cal1 += 1
		cal2 += 2
	if n - cal1 > 0:
		if (n - cal1) % 2 == 1:
			print('YES')
			for _ in range(k - 1):
				print(1, end=' ')
			print(n - cal1)
			result = True
		elif n - cal2 > 0:
			if (n - cal2) % 2 == 0:
				print('YES')
				for _ in range(k - 1):
					print(2, end=' ')
				print(n - cal2)
				result = True
	if result == False:
		print('NO')


ileRazy = int(input())
for i in range(0, ileRazy):
	(n, k) = list(map(int, input().split()))
	wypisywanie = ''
	max = 0
	if n < k:
		print('NO')
	elif n == k:
		print('YES')
		for j in range(0, k - 1):
			wypisywanie = wypisywanie + '1 '
		wypisywanie = wypisywanie + '1'
		print(wypisywanie)
	else:
		pierwszeLiczbyParz = 2 * (k - 1)
		ostatniaLiczbaParz = n - pierwszeLiczbyParz
		pierwszeLiczbyNiep = k - 1
		ostatniaLiczbaNiep = n - pierwszeLiczbyNiep
		if ostatniaLiczbaParz > 0 and ostatniaLiczbaParz % 2 == 0:
			print('YES')
			for k in range(0, k - 1):
				wypisywanie = wypisywanie + '2 '
			wypisywanie = wypisywanie + str(ostatniaLiczbaParz)
			print(wypisywanie)
		elif ostatniaLiczbaNiep > 0 and ostatniaLiczbaNiep % 2 == 1:
			print('YES')
			for k in range(0, k - 1):
				wypisywanie = wypisywanie + '1 '
			wypisywanie = wypisywanie + str(ostatniaLiczbaNiep)
			print(wypisywanie)
		else:
			print('NO')


for _ in ' ' * int(input()):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
	elif n % 2 == k % 2:
		print('YES')
		print(*list('1' * (k - 1)), end=' ')
		print(n - 1 * (k - 1))
	elif n % 2 != 0 and k % 2 == 0:
		print('NO')
	else:
		lst = list('2' * (k - 1))
		if 2 * (k - 1) >= n:
			print('NO')
		else:
			print('YES')
			print(*lst, end=' ')
			print(n - 2 * (k - 1))


import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda : readline().rstrip()
ni = lambda : int(readline().rstrip())
nm = lambda : map(int, readline().split())
nl = lambda : list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
	(n, k) = nm()
	l = [1] * (k - 1) + [n - k + 1]
	if l[-1] > 0 and l[-1] % 2:
		print('YES')
		print(*l)
		return
	l = [2] * (k - 1) + [n - 2 * (k - 1)]
	if l[-1] > 0 and l[-1] % 2 == 0:
		print('YES')
		print(*l)
		return
	print('NO')
	return
T = ni()
for _ in range(T):
	solve()


num_cases = int(input())
for case in range(num_cases):
	(num, terms) = [int(n) for n in input().split()]
	if terms > num:
		print('NO')
		continue
	base = num // terms
	num %= terms
	if num % 2 != 0:
		base -= 1
		num += terms
		if num % 2 != 0 or base == 0:
			print('NO')
			continue
	ans = [base for i in range(terms)]
	ans[0] += num
	print('YES')
	for no in ans:
		print(no, end=' ')
	print()


def answer(n, k):
	if n % 2 == 1:
		if k % 2 == 1:
			if n >= k:
				summands = [1] * (k - 1)
				summands.append(n - k + 1)
			else:
				return []
		else:
			return []
	elif k % 2 == 1:
		if n >= 2 * k:
			summands = [2] * (k - 1)
			summands.append(n - 2 * (k - 1))
		else:
			return []
	elif n >= k:
		summands = [1] * (k - 1)
		summands.append(n - k + 1)
	else:
		return []
	return summands
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	ans = answer(n, k)
	if ans:
		print('YES')
		print(' '.join(map(str, ans)))
	else:
		print('NO')


t = int(input())
sol = []
temp = []
for i in range(t):
	main = list(map(int, input().split()))
	if main[1] > main[0]:
		sol.append(0)
	elif main[0] % main[1] == 0:
		for y in range(main[1]):
			temp.append(main[0] // main[1])
		sol.append(temp)
	elif main[0] % 2 == 0 and main[1] % 2 != 0:
		if main[0] - (main[1] - 1) * 2 > 0:
			for j in range(main[1] - 1):
				temp.append(2)
			temp.append(main[0] - (main[1] - 1) * 2)
			sol.append(temp)
		else:
			sol.append(0)
	elif main[0] % 2 == 0 and main[1] % 2 == 0 or (main[0] % 2 != 0 and main[1] % 2 != 0):
		if main[0] - (main[1] - 1) > 0:
			for x in range(main[1] - 1):
				temp.append(1)
			temp.append(main[0] - (main[1] - 1))
			sol.append(temp)
		else:
			sol.append(0)
	elif main[0] % 2 != 0 and main[1] % 2 == 0:
		sol.append(0)
	temp = []
for xxx in sol:
	if xxx == 0:
		print('NO')
	else:
		print('YES')
		print(*xxx)


I = lambda : list(map(int, input().split()))
for tc in range(int(input())):
	(n, k) = I()
	if n % k == 0:
		print('YES')
		print((str(n // k) + ' ') * k)
	elif k > n:
		print('NO')
	else:
		t = (k - 1) * 2
		ans = n - t
		if ans % 2 == 0 and ans > 0:
			print('YES')
			print((str(2) + ' ') * (k - 1) + str(ans))
		else:
			t = k - 1
			ans = n - t
			if ans % 2 and ans > 0:
				print('YES')
				print((str(1) + ' ') * (k - 1) + str(ans))
			else:
				print('NO')


from math import *
mod = 10 ** 9 + 7

def _in():
	return [int(x) for x in input().split(' ')]

def main():
	(n, k) = _in()
	o = n - (k - 1)
	if o > 0 and o % 2 == 1:
		print('YES')
		print('1 ' * (k - 1), end='')
		print(o)
	else:
		e = n - 2 * (k - 1)
		if e > 0 and e % 2 == 0:
			print('YES')
			print('2 ' * (k - 1), end='')
			print(e)
		else:
			print('NO')
for _ in range(int(input())):
	main()


def function(n, k):
	l_odd = [1] * (k - 1)
	l_odd.append(n - sum(l_odd))
	condition1 = True
	for i in l_odd:
		if i % 2 == 0 or i <= 0:
			condition1 = False
			break
	if condition1:
		print('YES')
		print(*l_odd)
	condition2 = True
	if not condition1:
		l_even = [2] * (k - 1)
		l_even.append(n - sum(l_even))
		for j in l_even:
			if j % 2 != 0 or j <= 0:
				condition2 = False
				break
		if condition2:
			print('YES')
			print(*l_even)
	if condition1 == False and condition2 == False:
		print('NO')
t = int(input())
for k1 in range(t):
	(n, k) = map(int, input().rstrip().split())
	function(n, k)


t = int(input())
results = []
for i in range(t):
	(n, k) = [int(x) for x in input().strip().split(' ')]
	if n % 2 == 1 and k % 2 == 0 or n < k:
		results.append(None)
	elif n == k:
		tmp = '1 ' * k
		results.append(tmp.strip())
	elif n % 2 == 1 and k % 2 == 1:
		tmp = '1 ' * (k - 1)
		tmp += str(n - k + 1)
		results.append(tmp)
	elif n % 2 == 0 and k % 2 == 1:
		tmp = '2 ' * (k - 1)
		if 2 * (k - 1) >= n - 1:
			results.append(None)
		else:
			tmp += str(n - 2 * (k - 1))
			results.append(tmp)
	elif n % 2 == 0 and k % 2 == 0:
		tmp = '1 ' * (k - 1)
		tmp += str(n - k + 1)
		results.append(tmp)
	else:
		results.append(None)
for r in results:
	if r is None:
		print('NO')
	else:
		print('YES')
		print(r)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
	elif n % 2 == 1 and k % 2 == 0:
		print('NO')
	elif n % 2 == 1:
		a = n // k
		if a % 2 == 0:
			a -= 1
		lis = [a] * (k - 1)
		b = n - a * (k - 1)
		if b != 0:
			lis.append(b)
		print('YES')
		print(*lis)
	elif k % 2 == 0:
		a = n // k
		lis = [a] * (k - 1)
		b = n - a * (k - 1)
		if b != 0:
			lis.append(b)
		print('YES')
		print(*lis)
	else:
		a = n // k
		if a < 2:
			print('NO')
		else:
			if a % 2 == 1:
				a -= 1
			lis = [a] * (k - 1)
			b = n - a * (k - 1)
			if b != 0:
				lis.append(b)
			print('YES')
			print(*lis)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	l = []
	if m > n:
		print('NO')
		continue
	elif n // m > 1:
		if m % 2 == 0:
			if n % 2 == 0:
				s = 0
				for i in range(m - 1):
					l.append(2)
					s += 2
				if (n - s) % 2 == 0:
					l.append(n - s)
					print('YES')
					print(*l)
				else:
					print('NO')
			else:
				s = 0
				for i in range(m - 1):
					l.append(1)
					s += 1
				if (n - s) % 2 == 1:
					l.append(n - s)
					print('YES')
					print(*l)
				else:
					print('NO')
		elif n % 2 == 0:
			s = 0
			for i in range(m - 1):
				l.append(2)
				s += 2
			if (n - s) % 2 == 0:
				l.append(n - s)
				print('YES')
				print(*l)
			else:
				print('NO')
		else:
			s = 0
			for i in range(m - 1):
				l.append(1)
				s += 1
			if (n - s) % 2 == 1:
				l.append(n - s)
				print('YES')
				print(*l)
			else:
				print('NO')
	else:
		s = 0
		for i in range(m - 1):
			l.append(1)
			s += 1
		if (n - s) % 2 == 1:
			l.append(n - s)
			print('YES')
			print(*l)
		else:
			print('NO')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	if n % 2 != 0 and k % 2 == 0:
		print('NO')
	if n % 2 == 0 and k % 2 == 0:
		s = 0
		if n < k:
			print('NO')
		else:
			print('YES')
			for i in range(1, k):
				print(1, end=' ')
				s += 1
			print(n - s)
	if n % 2 == 0 and k % 2 != 0:
		s = 0
		if n < 2 * k:
			print('NO')
		else:
			print('YES')
			for i in range(1, k):
				print(2, end=' ')
				s += 2
			print(n - s)
	if n % 2 != 0 and k % 2 != 0:
		s = 0
		if n < k:
			print('NO')
		else:
			print('YES')
			for i in range(1, k):
				print(1, end=' ')
				s += 1
			print(n - s)


t = int(input())
x = []
for i in range(t):
	(n, k) = map(int, input().split())
	if n % 2 == 1 and k % 2 == 0 or k > n:
		print('NO')
	elif n % 2 == 0 and k % 2 == 1:
		if k * 2 > n:
			print('NO')
		else:
			print('YES')
			for j in range(1, k):
				print(2, end=' ')
			print(n - 2 * k + 2)
	else:
		print('YES')
		for j in range(1, k):
			print(1, end=' ')
		print(n - k + 1)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	(m, l) = (n % 2, k % 2)
	if m == 0 and l == 0 and (n >= k):
		print('YES')
		print(*[1] * (k - 1) + [n - k + 1])
	elif m == 0 and l == 1 and (n >= 2 * k):
		print('YES')
		print(*[2] * (k - 1) + [n - 2 * (k - 1)])
	elif m == 1 and l == 1 and (n >= k):
		print('YES')
		print(*[1] * (k - 1) + [n - k + 1])
	else:
		print('NO')


for k in range(int(input())):
	(n, s) = map(int, input().split())
	if (n - (s - 1)) % 2 != 0 and n - (s - 1) > 0:
		print('YES')
		print(*[1] * (s - 1) + [n - (s - 1)])
	elif (n - (s - 1) * 2) % 2 == 0 and n - (s - 1) * 2 > 0:
		print('YES')
		print(*[2] * (s - 1) + [n - (s - 1) * 2])
	else:
		print('NO')


R1 = lambda : list(map(int, input().split()))
R2 = lambda : int(input())
t = R2()
for _ in range(t):
	(n, k) = R1()
	if n % 2 == 0 and n >= 2 * k:
		print('YES')
		print('2 ' * (k - 1), n - 2 * (k - 1))
	elif n - k >= 0 and (n - k + 1) % 2 != 0:
		print('YES')
		print('1 ' * (k - 1), n - k + 1)
	else:
		print('NO')


t = int(input())
for tt in range(t):
	(n, k) = (int(i) for i in input().split())
	if k <= n and (n - k) % 2 == 0:
		print('YES')
		ans = [1] * k
		ans[0] = n - k + 1
		print(' '.join((str(i) for i in ans)))
	elif 2 * k <= n and (n - 2 * k) % 2 == 0:
		print('YES')
		ans = [2] * k
		ans[0] = n - 2 * k + 2
		print(' '.join((str(i) for i in ans)))
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
	elif k == n:
		print('YES')
		a = [1] * k
		print(*a)
	elif n % 2 != 0:
		t1 = n - (k - 1)
		if t1 % 2 != 0:
			if t1 >= 1:
				print('YES')
				a = [1] * (k - 1)
				a.append(t1)
				print(*a)
			else:
				print('NO')
		else:
			print('NO')
	else:
		t1 = n - (k - 1)
		if t1 % 2 != 0:
			if t1 < 1:
				print('NO')
			else:
				print('YES')
				a = [1] * (k - 1)
				a.append(t1)
				print(*a)
		else:
			t2 = n - 2 * (k - 1)
			if t2 > 0:
				print('YES')
				a = [2] * (k - 1)
				a.append(t2)
				print(*a)
			else:
				print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n < k:
		print('NO')
		continue
	if n // k * k == n:
		print('YES')
		for _ in range(k):
			print(n // k, end=' ')
		print()
		continue
	if n % 2 == 0 and k % 2 == 0:
		print('YES')
		for _ in range(k - 1):
			print(1, end=' ')
		print(n - k + 1)
	elif n % 2 == 0 and k % 2 != 0:
		if k > n // 2:
			print('NO')
		else:
			print('YES')
			for _ in range(k - 1):
				print(2, end=' ')
			print(n - (k - 1) * 2)
	elif n % 2 != 0 and k % 2 == 0:
		print('NO')
	else:
		print('YES')
		for _ in range(k - 1):
			print(1, end=' ')
		print(n - k + 1)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
	elif n % 2 == 0:
		if (k % 2 == 0 and (n - (k - 1) * 2) % 2 == 1) and (k % 2 == 0 and (n - k - 1) % 2 == 0):
			print('NO')
		elif k % 2 == 1 and (n - (k - 1) * 2) % 2 == 0:
			d = [2] * (k - 1)
			q = n - sum(d)
			if q > 0:
				d.append(q)
				print('YES')
				print(*d)
			else:
				print('NO')
		else:
			d = [1] * (k - 1)
			if n - k + 1 > 0:
				d.append(n - sum(d))
				print('YES')
				print(*d)
			else:
				print('NO')
	elif k % 2 == 1 and (n - k + 1) % 2 == 1 and (n - k + 1 > 0):
		d = [1] * (k - 1)
		d.append(n - k + 1)
		print('YES')
		print(*d)
	else:
		print('NO')


for i in range(int(input())):
	(n, k) = map(int, input().split())
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
	else:
		ans = ''
		if n % 2 == 1 and n - k + 1 > 0:
			print('YES')
			ans += '1 ' * (k - 1)
			ans += str(n - k + 1)
			print(ans)
		elif n % 2 == 0 and n - 2 * (k - 1) > 0:
			print('YES')
			ans += '2 ' * (k - 1)
			ans += str(n - 2 * (k - 1))
			print(ans)
		elif n % 2 == 0 and n - 1 * (k - 1) > 0 and (k % 2 == 0):
			print('YES')
			ans += '1 ' * (k - 1)
			ans += str(n - (k - 1))
			print(ans)
		else:
			print('NO')


tc = int(input())
while tc > 0:
	(n, k) = map(int, input().split())
	if n < k:
		print('NO')
	elif (n - k) % 2 == 0:
		print('YES')
		print('1 ' * (k - 1) + str(n - k + 1))
	elif n >= k * 2 and (n - k * 2) % 2 == 0:
		print('YES')
		print('2 ' * (k - 1) + str(n - (k - 1) * 2))
	else:
		print('NO')
	tc -= 1


for i in range(int(input())):
	a = list(map(int, input().strip().split()))[:2]
	v = []
	if a[0] < a[1]:
		print('NO')
	else:
		if a[0] % 2 == 0 and a[1] <= int(a[0] / 2):
			print('YES')
			while a[1] > 1:
				v.append(str(2))
				a[1] -= 1
				a[0] = a[0] - 2
			v.append(str(a[0]))
		elif a[0] % 2 == 0 and a[1] > int(a[0] / 2):
			if a[1] % 2 == 0:
				print('YES')
				while a[1] != 1:
					v.append(str(1))
					a[1] -= 1
					a[0] -= 1
				v.append(str(a[0]))
			else:
				print('NO', end=' ')
		elif a[0] % 2 != 0 and a[1] % 2 == 0:
			print('NO', end=' ')
		else:
			print('YES')
			while a[1] != 1:
				v.append(str(1))
				a[1] -= 1
				a[0] -= 1
			v.append(str(a[0]))
		print(' '.join(v))


for _ in range(int(input())):
	(n, k) = list(map(int, input().split(' ')))
	if n < k:
		print('NO')
	elif k % 2:
		if n % 2:
			if (n - (k - 1)) % 2 == 0:
				print('NO')
			else:
				print('YES')
				print(' '.join(['1'] * (k - 1)) + ' ' + str(n - (k - 1)))
		elif n - 2 * (k - 1) < 2 or (n - 2 * (k - 1)) % 2:
			print('NO')
		else:
			print('YES')
			print(' '.join(['2'] * (k - 1)) + ' ' + str(n - 2 * (k - 1)))
	elif n % 2:
		print('NO')
	elif not (n - 2 * (k - 1) < 2 or (n - 2 * (k - 1)) % 2):
		print('YES')
		print(' '.join(['2'] * (k - 1)) + ' ' + str(n - 2 * (k - 1)))
	elif not (n - (k - 1)) % 2 == 0:
		print('YES')
		print(' '.join(['1'] * (k - 1)) + ' ' + str(n - (k - 1)))
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split(' '))
	if a - b >= 0 and a - b & 1 == 0:
		print('YES')
		print('1 ' * (b - 1) + str(a - b + 1))
	elif a - 2 * b + 2 & 1 == 0 and a - 2 * b + 2 > 0:
		print('YES')
		print('2 ' * (b - 1) + str(a - 2 * b + 2))
	else:
		print('NO')


s = []
for jjk in range(int(input())):
	(n, k) = map(int, input().split())
	if n % 2 == 0:
		if k % 2 == 1:
			p = [2 for i in range(k - 1)]
			if n - 2 * (k - 1) > 0:
				s.append(['yes'])
				p.append(n - 2 * (k - 1))
				s.append(p)
			else:
				s.append(['no'])
		else:
			p = [1 for i in range(k - 1)]
			if n - 1 * (k - 1) > 0:
				s.append(['yes'])
				p.append(n - 1 * (k - 1))
				s.append(p)
			else:
				s.append(['no'])
	elif k % 2 == 0:
		s.append(['no'])
	else:
		p = [1 for i in range(k - 1)]
		if n - 1 * (k - 1) > 0:
			s.append(['yes'])
			p.append(n - 1 * (k - 1))
			s.append(p)
		else:
			s.append(['no'])
for i in s:
	for j in i:
		print(j, end=' ')
	print()


t = int(input())
for _ in range(t):
	(n, k) = [int(x) for x in input().split()]
	bigNum = n - k + 1
	if bigNum <= 0:
		print('NO')
	elif bigNum % 2:
		print('YES')
		print(' '.join(map(str, [1] * (k - 1) + [bigNum])))
	elif (k - 1) % 2 or k - 1 >= bigNum:
		print('NO')
	else:
		print('YES')
		print(' '.join(map(str, [2] * (k - 1) + [bigNum - k + 1])))


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
	elif k == n:
		print('YES')
		l = [1] * n
		print(*l)
	else:
		cur = n - k + 1
		if cur % 2 == 1:
			l = [1] * (k - 1)
			l.append(cur)
			print('YES')
			print(*l)
		else:
			temp = (k - 1) * 2
			if temp < n:
				dif = n - temp
				if dif % 2 == 0:
					l = [2] * (k - 1)
					l.append(dif)
					print('YES')
					print(*l)
				else:
					print('NO')
			else:
				print('NO')


t = int(input())
while t:
	(n, k) = map(int, input().split())
	if (n - (k - 1)) % 2 != 0 and n - (k - 1) > 0:
		print('YES')
		for i in range(k - 1):
			print('1', end=' ')
		print(n - (k - 1))
	elif (n - 2 * (k - 1)) % 2 == 0 and n - 2 * (k - 1) > 0:
		print('YES')
		for i in range(k - 1):
			print('2', end=' ')
		print(n - 2 * (k - 1))
	else:
		print('NO')
	t -= 1


t = int(input())
for _ in range(t):
	(n, k) = [int(x) for x in input().split()]
	ans = []
	if n % 2 == k % 2:
		while k > 1:
			n -= 1
			ans.append(1)
			k -= 1
		ans.append(n)
	elif n % 2 == 1:
		print('NO')
		continue
	else:
		while k > 1:
			n -= 2
			ans.append(2)
			k -= 1
		ans.append(n)
	if ans[-1] <= 0:
		print('NO')
	else:
		print('YES')
		print(' '.join([str(x) for x in ans]))


t = int(input())
while t > 0:
	t -= 1
	(N, K) = map(int, input().split())
	if N % 2 == 1:
		if K % 2 == 0 or N < K:
			print('NO')
			continue
		else:
			print('YES')
			K -= 1
			while K > 0:
				K -= 1
				print('1', end=' ')
				N -= 1
			print(N)
	elif K % 2 == 1 and N < K * 2 or (K % 2 == 0 and N < K):
		print('NO')
		continue
	elif K % 2 == 1:
		print('YES')
		K -= 1
		while K > 0:
			K -= 1
			print('2', end=' ')
			N -= 2
		print(N)
	else:
		print('YES')
		K -= 1
		while K > 0:
			K -= 1
			print('1', end=' ')
			N -= 1
		print(N)


import math
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if k > n or (n % 2 == 1 and k % 2 == 0):
		print('NO')
	elif n == k:
		print('YES')
		for i in range(k):
			print(1, end=' ')
		print()
	elif n % 2 == 1 and k % 2 == 1:
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(n - (k - 1))
	elif n % 2 == 0:
		if k > n // 2:
			if (n - (k - 1)) % 2 == 1:
				print('YES')
				for i in range(k - 1):
					print(1, end=' ')
				print(n - (k - 1))
			else:
				print('NO')
		else:
			print('YES')
			for i in range(k - 1):
				print(2, end=' ')
			print(n - 2 * (k - 1))


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	list1 = []
	list2 = []
	c = 0
	if n >= k:
		for i in range(k - 1):
			list1.append(1)
		list1.append(n - k + 1)
		for i in range(k - 1):
			list2.append(2)
		list2.append(n - 2 * (k - 1))
		if list1[k - 1] & 1:
			c = 1
		elif list2[k - 1] > 0 and list2[k - 1] % 2 == 0:
			c = 2
	if c == 1:
		print('YES')
		for i in list1:
			print(i, end=' ')
		print()
	elif c == 2:
		print('YES')
		for i in list2:
			print(i, end=' ')
		print()
	else:
		print('NO')


import sys

def solve():
	return None

def main():
	q = []
	for line in sys.stdin.readlines():
		q.append(line)
	for i in range(len(q)):
		q[i] = q[i].rstrip().split(' ')
		q[i] = [int(x) for x in q[i]]
	for i in range(1, len(q)):
		n = q[i][0]
		k = q[i][1]
		oddtry = n
		eventry = n
		for i in range(k - 1):
			oddtry -= 1
			eventry -= 2
		if eventry % 2 == 0 and eventry >= 2:
			print('YES')
			print('2 ' * (k - 1), end='')
			print(str(eventry))
		elif oddtry % 2 == 1 and oddtry >= 1:
			print('YES')
			print('1 ' * (k - 1), end='')
			print(str(oddtry))
		else:
			print('NO')
main()


for _ in range(int(input())):
	(n, k) = [int(x) for x in input().split()]
	b = 2 if n % 2 == 0 and k % 2 == 1 else 1
	l = [b] * (k - 1)
	r = n - sum(l)
	if r > 0 and r % 2 == b % 2:
		l.append(r)
		print('YES')
		print(' '.join((str(x) for x in l)))
	else:
		print('NO')


t = int(input())
for i in range(t):
	l = input().split()
	n = int(l[0])
	k = int(l[1])
	v1 = k - 1
	if v1 < n and (n - v1) % 2 == 1:
		v1 = n
	else:
		v1 = 0
	v2 = 2 * (k - 1)
	if v2 < n and (n - v2) % 2 == 0:
		v2 = n
	else:
		v2 = 0
	if v1 == n:
		print('YES')
		if k > 1:
			for j in range(k - 1):
				print('1', end=' ')
		print(n - (k - 1))
		continue
	if v2 == n:
		print('YES')
		if k > 1:
			for j in range(k - 1):
				print('2', end=' ')
		print(n - 2 * (k - 1))
		continue
	print('NO')


test = int(input())
for _ in range(test):
	(n, k) = map(int, input().split())
	lis = []
	flag = 0
	if n % 2 == 0:
		if k * 2 <= n:
			lis = [2] * k
			d = n - k * 2
			lis[0] += d
		elif k <= n:
			if (n - k) % 2 == 0:
				lis = [1] * k
				d = n - k
				lis[0] += d
			else:
				flag = 1
		else:
			flag = 1
	elif n % 2 != 0 and k <= n and (k % 2 != 0):
		lis = [1] * k
		d = n - k
		lis[0] += d
	else:
		flag = 1
	if flag == 1:
		print('NO')
	else:
		print('YES')
		for i in lis:
			print(i, end=' ')
		print()


import sys
input = sys.stdin.readline

def solve(n, k):
	if k > n:
		print('NO')
		return
	res = [n // k for _ in range(k)]
	rem = n % k
	if rem > 0:
		if rem % 2 == 1:
			for ii in range(k):
				res[ii] -= 1
				if res[ii] == 0:
					print('NO')
					return
				rem += 1
		if rem % 2 == 1:
			print('NO')
			return
		for ii in range(k):
			if rem > 0:
				res[ii] += 2
				rem -= 2
			else:
				break
	print('YES')
	print(' '.join(map(str, res)))
t = int(input())
for _ in range(t):
	[n, k] = map(int, input().split())
	solve(n, k)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	x = int(n / k) - 1
	count = 0
	for j in range(3):
		if (n - (k - 1) * x) % 2 == x % 2 and x > 0 and (n - (k - 1) * x > 0):
			print('YES')
			for s in range(k - 1):
				print(x, end=' ')
			print(n - (k - 1) * x)
			count = 1
			break
		x = x + 1
	if count == 0:
		print('NO')


def odd(x):
	return x % 2 == 1

def solve(n, k):
	if n - (k - 1) > 0 and odd(n - (k - 1)):
		return [1 for _ in range(k - 1)] + [n - (k - 1)]
	if n - 2 * (k - 1) > 0 and (not odd(n - 2 * (k - 1))):
		return [2 for _ in range(k - 1)] + [n - 2 * (k - 1)]
	return []
cases = int(input())
for _ in range(cases):
	ans = solve(*map(int, input().split()))
	if len(ans) == 0:
		print('NO')
	else:
		print('YES')
		print(*ans)


t = int(input())

def solve(n, k):
	if k > n:
		print('NO')
		return
	elif n % k == 0:
		print('YES')
		ans = [n // k for _ in range(k)]
		print(' '.join(list(map(str, ans))))
		return
	else:
		div = n // k
		leftover = n - div * (k - 1)
		if leftover > 0 and div > 0 and (leftover % 2 == div % 2):
			print('YES')
			ans = [n // k for _ in range(k - 1)]
			ans.append(leftover)
			print(' '.join(list(map(str, ans))))
			return
		div = n // k + 1
		leftover = n - div * (k - 1)
		if leftover > 0 and div > 0 and (leftover % 2 == div % 2):
			print('YES')
			ans = [n // k + 1 for _ in range(k - 1)]
			ans.append(leftover)
			print(' '.join(list(map(str, ans))))
			return
		div = n // k - 1
		leftover = n - div * (k - 1)
		if leftover > 0 and div > 0 and (leftover % 2 == div % 2):
			print('YES')
			ans = [n // k - 1 for _ in range(k - 1)]
			ans.append(leftover)
			print(' '.join(list(map(str, ans))))
			return
		else:
			print('NO')
			return
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	solve(n, k)


T = int(input())
while T != 0:
	(n, k) = map(int, input().split())
	type_even = n / k
	n1 = n - (k - 1)
	if n1 > 0 and n1 % 2 == 1:
		print('YES')
		fa = [1] * (k - 1)
		fa.append(n1)
		print(' '.join([str(e) for e in fa]))
		T -= 1
		continue
	n2 = n - 2 * (k - 1)
	if n2 > 0 and n2 % 2 == 0:
		print('YES')
		fa = [2] * (k - 1)
		fa.append(n2)
		print(' '.join([str(e) for e in fa]))
		T -= 1
		continue
	print('NO')
	T -= 1


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n < k or (n % 2 == 1 and k % 2 == 0):
		print('NO')
	elif n % 2 == k % 2:
		ans = [1] * (k - 1)
		ans += [n - k + 1]
		print('YES')
		print(*ans)
	elif n < k * 2:
		print('NO')
	else:
		ans = [2] * (k - 1)
		ans += [n - 2 * (k - 1)]
		print('YES')
		print(*ans)


t = int(input())
for i in range(t):
	inp = input().split(' ')
	n = int(inp[0])
	k = int(inp[1])
	if n % 2 and k % 2 == 0:
		print('NO')
		continue
	ans = []
	if n % 2 == k % 2:
		ans.append(n - (k - 1))
		for i in range(k - 1):
			ans.append(1)
	else:
		ans.append(n - 2 * (k - 1))
		for i in range(k - 1):
			ans.append(2)
	poss = 1
	od = 0
	ev = 0
	for elem in ans:
		if elem <= 0:
			poss = 0
			break
		od += elem % 2
		ev += elem % 2 == 0
	if od > 0 and ev > 0:
		poss = 0
	if poss == 1:
		print('YES')
		for elem in ans:
			print(elem, end=' ')
		print('')
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	ans = []
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
	elif k > n:
		print('NO')
	else:
		if n & 1 or n // 2 < k:
			ans.append(n - (k - 1))
			for i in range(k - 1):
				ans.append(1)
		else:
			ans.append(n - (k - 1) * 2)
			for i in range(k - 1):
				ans.append(2)
		flag = flag2 = False
		for i in range(len(ans)):
			if ans[i] & 1:
				flag = True
			else:
				flag2 = True
		if flag == flag2 == True:
			print('NO')
		else:
			print('YES')
			print(*ans[:])


def checkPossibility(n, k):
	ans = []
	if n % 2 == 1 and k % 2 == 0:
		return ans
	elif n % 2 == 1:
		if n - k >= 0:
			ans = [1 for _ in range(k - 1)] + [n - k + 1]
	elif n % 2 == 0 and k % 2 == 1:
		if n - 2 * k >= 0:
			ans = [2 for _ in range(k - 1)] + [n - 2 * k + 2]
		pass
	elif n % 2 == 0 and k % 2 == 0:
		if n - k >= 0:
			ans = [1 for _ in range(k - 1)] + [n - k + 1]
		pass
	return ans

def printList(lst):
	for v in lst:
		print(v, end=' ')
	print()
t = int(input())
for i in range(t):
	values = [int(a) for a in input().split(' ')]
	n = values[0]
	k = values[1]
	lst = checkPossibility(n, k)
	if not lst:
		print('NO')
	else:
		print('YES')
		printList(lst)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	if n % 2 == 1:
		if k % 2 == 0:
			print('NO')
		elif k > n:
			print('NO')
		else:
			print('YES')
			for i in range(k - 1):
				print(1, sep=' ', end=' ')
			print(n - k + 1, sep=' ')
	elif k > n:
		print('NO')
	elif k % 2 == 0:
		print('YES')
		for i in range(k - 1):
			print(1, sep=' ', end=' ')
		print(n - k + 1, sep=' ')
	else:
		d = n // 2
		if d < k:
			print('NO')
		else:
			print('YES')
			for i in range(k - 1):
				print(2, sep=' ', end=' ')
			print(n - 2 * k + 2, sep=' ')


test = int(input())
for t in range(test):
	(n, k) = map(int, input().split(' '))
	if n % 2 == 0:
		if k > n:
			print('NO')
		elif k <= n // 2:
			print('YES')
			l = []
			l.append(2 * (n // 2 - k + 1))
			for i in range(k - 1):
				l.append(2)
			for j in range(len(l)):
				print(str(l[j]) + ' ', end='')
			print()
		elif (n - k + 1) % 2 == 1:
			print('YES')
			l = []
			l.append(n - k + 1)
			for j in range(k - 1):
				l.append(1)
			for j in range(len(l)):
				print(str(l[j]) + ' ', end='')
			print()
		else:
			print('NO')
	elif k > n:
		print('NO')
	elif k % 2 == 0:
		print('NO')
	elif (n - k + 1) % 2 == 1:
		print('YES')
		l = []
		l.append(n - k + 1)
		for j in range(k - 1):
			l.append(1)
		for j in range(len(l)):
			print(str(l[j]) + ' ', end='')
		print()
	else:
		print('NO')


from collections import defaultdict
import sys
input = sys.stdin.readline
inf = 100000000000000000
mod = 998244353
for CASES in range(int(input())):
	ANS = []
	(n, k) = map(int, input().split())
	(yu, shan) = divmod(n, k)
	if shan % 2 == 1 and k % 2 == 0:
		print('NO')
	else:
		if shan % 2 == 1:
			yu -= 1
		if yu <= 0:
			print('NO')
			continue
		for i in range(k - 1):
			ANS.append(yu)
			n -= yu
		ANS.append(n)
		print('YES')
		print(*ANS)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	if n < k:
		print('NO')
	elif k == 1:
		print('YES')
		print(n)
	elif n % 2 == 1 and k % 2 == 1:
		ls = []
		while k > 1:
			n -= 1
			ls.append(1)
			k -= 1
		if k == 1:
			if n % 2 == 1:
				print('YES')
				ls.append(n)
				print(' '.join(map(str, ls)))
			else:
				print('NO')
	elif n % 2 == 1 and k % 2 == 0:
		print('NO')
	elif n % 2 == 0 and k % 2 == 0:
		ls = []
		while k > 1:
			n -= 1
			ls.append(1)
			k -= 1
		if k == 1:
			if n % 2 == 1:
				print('YES')
				ls.append(n)
				print(' '.join(map(str, ls)))
			else:
				print('NO')
	elif n % 2 == 0 and k % 2 == 1:
		ls = []
		while k > 1:
			n -= 2
			ls.append(2)
			k -= 1
		if k == 1:
			if n % 2 == 0 and n > 0:
				print('YES')
				ls.append(n)
				print(' '.join(map(str, ls)))
			else:
				print('NO')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
		continue
	else:
		an = []
		if n % 2 == 1 and k % 2 == 1:
			for j in range(k - 1):
				an.append(1)
			an.append(n - k + 1)
			print('YES')
			print(' '.join(map(str, an)))
		elif n % 2 == 1 and k % 2 == 0:
			print('NO')
		elif n % 2 == 0 and k % 2 == 0:
			for j in range(k - 1):
				an.append(1)
			an.append(n - k + 1)
			print('YES')
			print(' '.join(map(str, an)))
		elif 2 * k > n:
			print('NO')
		else:
			for j in range(k - 1):
				an.append(2)
			an.append(n - 2 * (k - 1))
			print('YES')
			print(' '.join(map(str, an)))


import sys
strInp = lambda : input().strip().split()
intInp = lambda : list(map(int, strInp()))
for t in range(int(input())):
	(n, k) = intInp()
	x = n - k + 1
	y = n - 2 * k + 2
	if x > 0 and x % 2 != 0 or (y > 0 and y % 2 == 0):
		print('YES')
		if x > 0 and x % 2 != 0:
			for i in range(k - 1):
				print(1, end=' ')
				n -= 1
			print(n)
		else:
			for i in range(k - 1):
				print(2, end=' ')
				n -= 2
			print(n)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, k) = [int(x) for x in input().split()]
	if n < k:
		print('NO')
		continue
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
		continue
	if n % 2 == 0 and k % 2 == 1:
		if n < 2 * k:
			print('NO')
			continue
		ans = [2] * (k - 1) + [n - 2 * (k - 1)]
	else:
		ans = [1] * (k - 1) + [n - (k - 1)]
	print('YES')
	print(*ans, sep=' ')


def main():
	t = int(input())
	for i in range(t):
		nk = list(map(int, input().split()))
		n = nk[0]
		m = nk[1]
		if n < m:
			print('NO')
		elif n % m == 0:
			print('YES')
			resultado = int(n / m)
			lista = [resultado] * m
			print(*lista)
		elif n % 2 != 0 and m % 2 == 0:
			print('NO')
		elif n % 2 == 0 and m % 2 != 0:
			if n / 2 < m:
				print('NO')
			else:
				print('YES')
				lista = []
				for i in range(m - 1):
					lista.append(2)
				lista.append(n - 2 * (m - 1))
				print(*lista)
		else:
			print('YES')
			lista = []
			for i in range(m - 1):
				lista.append(1)
			lista.append(n - (m - 1))
			print(*lista)
main()


t = int(input())
l = []
for i in range(t):
	a = []
	a = [int(x) for x in input().split()]
	l.append(a)
for x in l:
	n = x[0]
	k = x[1]
	if n % k == 0:
		p = int(n / k)
		print('YES')
		for i in range(k):
			print(p, end=' ')
		print()
	elif n < k:
		print('NO')
	elif n % 2 == 1 and k % 2 == 0:
		print('NO')
	elif n % 2 == k % 2:
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(n - k + 1, end=' ')
		print()
	else:
		p = int(n / k)
		if p < 2:
			print('NO')
		else:
			print('YES')
			for i in range(k - 1):
				print(2, end=' ')
			print(n - 2 * (k - 1), end=' ')
			print()


t = int(input())
for _ in range(t):
	result = []
	(n, k) = map(int, input().split())
	if n < k:
		print('NO')
		continue
	if n & 1:
		if k & 1 == 0:
			print('NO')
			continue
		for i in range(k - 1):
			result += [1]
		result += [n - k + 1]
	elif k & 1:
		if (k - 1) * 2 >= n:
			print('NO')
			continue
		for i in range(k - 1):
			result += [2]
		result += [n - (k - 1) * 2]
	elif n - (k - 1) & 1:
		for i in range(k - 1):
			result += [1]
		result += [n - k + 1]
	else:
		for i in range(k - 1):
			result += [2]
		result += [n - (k - 1) * 2]
	print('YES')
	print(*result)


for i in range(int(input())):
	(n, k) = [int(num) for num in input().split()]
	if n % 2 == 0 and k % 2 == 0 and (n >= k):
		x = [1] * (k - 1)
		c = n - sum(x)
		x.append(c)
		if x[-1] <= 0:
			print('NO')
			x.clear()
		else:
			print('YES')
			print(*x, sep=' ')
			x.clear()
	elif n % 2 == 0 and k % 2 != 0 and (n >= k):
		x = [2] * (k - 1)
		c = n - sum(x)
		x.append(c)
		if x[-1] <= 0:
			print('NO')
			x.clear()
		else:
			print('YES')
			print(*x, sep=' ')
			x.clear()
	elif n % 2 != 0 and k % 2 != 0 and (n >= k):
		x = [1] * (k - 1)
		c = n - sum(x)
		x.append(c)
		if x[-1] <= 0:
			print('NO')
			x.clear()
		else:
			print('YES')
			print(*x, sep=' ')
			x.clear()
	elif n % 2 != 0 and k % 2 == 0 or n < k:
		print('NO')


for x in range(int(input())):
	(h, m) = list(map(int, input().split()))
	k = []
	if h % 2 == 0 and m % 2 == 0:
		r = 'YES'
		while m > 0:
			if m == 1:
				k.append(h)
				break
			elif h > 1:
				k.append(1)
				m -= 1
				h -= 1
			else:
				r = 'NO'
				break
		if r == 'NO':
			print(r)
		else:
			print(r)
			print(*k)
	elif h % 2 == 0 and m % 2 != 0:
		r = 'YES'
		while m > 0:
			if m == 1:
				k.append(h)
				break
			elif h > 2:
				k.append(2)
				m -= 1
				h -= 2
			else:
				r = 'NO'
				break
		if r == 'NO':
			print(r)
		else:
			print(r)
			print(*k)
	elif h % 2 != 0 and m % 2 == 0:
		print('NO')
	elif h % 2 != 0 and m % 2 != 0:
		r = 'YES'
		while m > 0:
			if m == 1:
				k.append(h)
				break
			elif h > 1:
				k.append(1)
				m -= 1
				h -= 1
			else:
				r = 'NO'
				break
		if r == 'NO':
			print(r)
		else:
			print(r)
			print(*k)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	if k == 1:
		print('YES')
		print(n)
	else:
		liste = []
		no = n - (k - 1)
		if no > 0 and no % 2 == 1:
			for j in range(k - 1):
				liste.append('1')
			liste.append(no)
			print('YES')
			print(*liste)
			continue
		liste = []
		no = n - 2 * (k - 1)
		if no > 0 and no % 2 == 0:
			for j in range(k - 1):
				liste.append('2')
			liste.append(no)
			print('YES')
			print(*liste)
			continue
		print('NO')


k = int(input())
for k0 in range(k):
	(n, k) = map(int, input().split())
	n1 = n - (k - 1)
	n2 = n - 2 * (k - 1)
	if n2 % 2 == 0 and n2 > 0:
		print('YES')
		print(*[n2] + [2] * (k - 1))
	elif n1 % 2 == 1 and n1 > 0:
		print('YES')
		print(*[n1] + [1] * (k - 1))
	else:
		print('NO')


for i in range(int(input())):
	(n, k) = list(map(int, input().split()))
	f = 0
	d = []
	if (n + k) % 2 == 0:
		for i in range(k - 1):
			d.append(1)
		if n - sum(d) > 0:
			d.append(n - sum(d))
			if sum(d) == n:
				f = 1
				print('YES')
				d = ' '.join((str(i) for i in d))
				print(d)
		else:
			f = 0
	elif n % 2 == 0:
		for j in range(k - 1):
			d.append(2)
		if n - sum(d) > 0:
			d.append(n - sum(d))
			if sum(d) == n:
				f = 1
				print('YES')
				d = ' '.join((str(i) for i in d))
				print(d)
			else:
				f = 0
		else:
			f = 0
	if f == 0:
		print('NO')


tc = int(input())
for t in range(tc):
	(n, k) = map(int, input().split())
	val = k - 1
	remainder = n - (k - 1)
	if remainder > 0 and remainder % 2 == 1:
		print('YES')
		print(str(remainder), end=' ')
		for i in range(k - 1):
			print('1', end=' ')
		print()
		continue
	remainder = n - 2 * (k - 1)
	if remainder > 0 and remainder % 2 == 0:
		print('YES')
		print(str(remainder), end=' ')
		for i in range(k - 1):
			print('2', end=' ')
		print()
		continue
	print('NO')


t = int(input())
ans = []
for case in range(t):
	flag = 0
	ans = []
	(n, k) = [int(n) for n in input().split()]
	if n < k or (n % 2 == 1 and k % 2 == 0):
		flag = 1
		print('NO')
	elif n % 2 == 0 and k % 2 == 1:
		if n < 2 * k:
			flag = 1
			print('NO')
		elif (n - k + 1) % 2 == 0:
			ans.append(n - 2 * (k - 1))
			if ans[0] < 0 or ans[0] % 2 == 1:
				flag = 1
				ans[0] = 0
			for i in range(k - 1):
				ans.append(2)
			if sum(ans) == n:
				print('YES')
			else:
				print('NO')
				flag = 1
	elif (n - k + 1) % 2 != 0:
		ans.append(n - k + 1)
		for i in range(k - 1):
			ans.append(1)
		if sum(ans) == n:
			print('YES')
		else:
			print('NO')
			flag = 1
	if flag == 0:
		for i in ans:
			print(i, end=' ')
		print()


i = int(input())
for _ in range(i):
	li = []
	(x, y) = map(int, input().split())
	if x == y:
		li = [1] * y
	elif x % 2 == 0:
		li = [2] * (y - 1) + [x - 2 * y + 2]
		if li[-1] < 2 or li[-1] % 2 != 0:
			li = [1] * (y - 1) + [x - 1 * y + 1]
			if li[-1] < 1 or li[-1] % 2 == 0:
				print('NO')
				continue
	else:
		li = [1] * (y - 1) + [x - y + 1]
		if li[-1] < 1 or li[-1] % 2 == 0:
			li = [2] * (y - 1) + [x - 2 * y + 2]
			if li[-1] < 2 or li[-1] % 2 != 0:
				print('NO')
				continue
	print('YES')
	for j in li[:-1]:
		print(j, end=' ')
	print(li[-1])


t = int(input())
for _ in range(t):
	(n, k) = [int(i) for i in input().split()]
	if (n % 2 == 0 and k % 2 == 0 or (n % 2 == 1 and k % 2 == 1)) and k <= n:
		print('YES')
		ans = '1 ' * (k - 1)
		ans += str(n - (k - 1))
		print(ans)
	elif (n % 2 == 0 and k % 2 == 1) and 2 * k <= n:
		print('YES')
		ans = '2 ' * (k - 1)
		ans += str(n - 2 * (k - 1))
		print(ans)
	else:
		print('NO')


for t in range(int(input())):
	(n, k) = map(int, input().split())
	p = n // k
	if k > n:
		print('NO')
	elif n % 2 == 0 and k % 2 == 0:
		print('YES')
		x = [str(n // k)] * (k - 1) + [str(n - n // k * (k - 1))]
		print(' '.join(x))
	elif n % 2 == 0 and k % 2 != 0:
		if n // k == 1:
			print('NO')
		else:
			print('YES')
			if p % 2 == 0:
				x = [str(p)] * (k - 1) + [str(n - p * (k - 1))]
				print(' '.join(x))
			else:
				x = [str(p - 1)] * (k - 1) + [str(n - (p - 1) * (k - 1))]
				print(' '.join(x))
	elif n % 2 != 0 and k % 2 == 0:
		print('NO')
	else:
		print('YES')
		if p % 2 == 0:
			x = [str(p - 1)] * (k - 1) + [str(n - (p - 1) * (k - 1))]
			print(' '.join(x))
		else:
			x = [str(p)] * (k - 1) + [str(n - p * (k - 1))]
			print(' '.join(x))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n % 2 == 0:
		if k % 2 == 0:
			if n > k - 1:
				print('YES')
				p = n - (k - 1)
				print('1 ' * (k - 1) + str(p))
			else:
				print('NO')
		elif n > 2 * (k - 1):
			print('YES')
			p = n - 2 * (k - 1)
			print('2 ' * (k - 1) + str(p))
		else:
			print('NO')
	elif k % 2 == 0:
		print('NO')
	elif n > k - 1:
		print('YES')
		p = n - k + 1
		print('1 ' * (k - 1) + str(p))
	else:
		print('NO')


for g in [*open(0)][1:]:
	(n, k) = map(int, g.split())
	if n % 2 == 1:
		if k % 2 == 0:
			print('NO')
		elif k % 2 == 1:
			if n < k:
				print('NO')
			else:
				print('YES')
				out = [1] * (k - 1)
				out = out + [n - k + 1]
				print(*out, end=' ')
				print()
	elif k % 2 == 1:
		if n < 2 * k:
			print('NO')
		else:
			print('YES')
			out = [2] * (k - 1)
			out = out + [n - 2 * k + 2]
			print(*out, end=' ')
			print()
	elif n < k:
		print('NO')
	else:
		print('YES')
		out = [1] * (k - 1)
		out = out + [n - k + 1]
		print(*out, end=' ')
		print()


test = int(input())
for i in range(test):
	(t, n) = input().split()
	t = int(t)
	n = int(n)
	ans = 'NO'
	if t % 2 != 0 and n % 2 != 0 and (t >= n):
		last = t - (n - 1) * 1
		anslist = '1 ' * (n - 1) + str(last)
		ans = 'YES'
	if t % 2 == 0 and n % 2 != 0 and (t >= 2 * n):
		last = t - (n - 1) * 2
		anslist = '2 ' * (n - 1) + str(last)
		ans = 'YES'
	if t % 2 == 0 and n % 2 == 0 and (t >= n):
		last = t - (n - 1) * 1
		anslist = '1 ' * (n - 1) + str(last)
		ans = 'YES'
	if ans == 'YES':
		print(ans)
		print(anslist)
	else:
		print(ans)


def solve(n, k):
	res = n - (k - 1)
	if res % 2 == 1 and res > 0:
		print('YES')
		arr = [1] * (k - 1) + [res]
		print(' '.join(list(map(str, arr))))
		return
	res = n - 2 * (k - 1)
	if res % 2 == 0 and res > 0:
		print('YES')
		arr = [2] * (k - 1) + [res]
		print(' '.join(list(map(str, arr))))
		return
	print('NO')
T = int(input())
for ti in range(1, T + 1):
	(n, k) = list(map(int, input().split(' ')))
	solve(n, k)


from sys import stdin
input = iter(stdin.readlines()).__next__
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	if n % 2 == 0:
		if k % 2 == 0:
			if n >= k:
				print('YES')
				print(*[1] * (k - 1), n - k + 1)
				continue
		elif n >= 2 * k:
			print('YES')
			print(*[2] * (k - 1), n - 2 * k + 2)
			continue
	elif k % 2 == 1:
		if n >= k:
			print('YES')
			print(*[1] * (k - 1), n - k + 1)
			continue
	print('NO')


t = int(input())
for i in range(t):
	lst = list(map(int, input().split()))
	f = lst[0]
	s = lst[1]
	if s > f:
		print('NO')
	elif f % 2 == 0 and s % 2 == 0 or (f % 2 == 1 and s % 2 == 1):
		print('YES')
		ans = []
		for j in range(s - 1):
			ans.append(1)
		ans.append(f - s + 1)
		print(*ans)
	elif f % 2 == 0 and s % 2 == 1:
		if 2 * s > f:
			print('NO')
		else:
			print('YES')
			ans = []
			for j in range(s - 1):
				ans.append(2)
			ans.append(f - 2 * (s - 1))
			print(*ans)
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	if n % 2 == 1:
		if k % 2 == 0 or n < k:
			print('NO')
		else:
			print('YES')
			print(n - k + 1, *[1] * (k - 1))
	elif k % 2 == 1:
		if k > n // 2:
			print('NO')
		else:
			print('YES')
			print(*[2] * (k - 1), n - (k - 1) * 2)
	elif k > n:
		print('NO')
	else:
		print('YES')
		print(n - k + 1, *[1] * (k - 1))


def is_same_parity(l):
	if all((i % 2 for i in l)) or all((i % 2 == 0 for i in l)):
		return True
	return False
for _ in range(int(input())):
	(n, k) = [int(i) for i in input().split()]
	if n % 2 and k % 2 or (n % 2 == 0 and k % 2 == 0):
		if n - (k - 1) < 0:
			print('NO')
		else:
			print('YES')
			result = [1] * (k - 1)
			result.append(n - (k - 1))
			for i in result:
				print(i, end=' ')
			print()
	elif n % 2 == 0 and k % 2:
		if n - 2 * (k - 1) <= 1:
			print('NO')
		else:
			result = [2] * (k - 1)
			result.append(n - 2 * (k - 1))
			if sum(result) == n and is_same_parity(result):
				print('YES')
				for i in result:
					print(i, end=' ')
				print()
			else:
				print('NO')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	num = []
	if n % k == 0:
		print('YES')
		for l in range(k):
			num.append(int(n / k))
		print(' '.join((str(i) for i in num)))
	elif n % 2 == 1 and k % 2 == 0 or (n % 2 == 0 and k % 2 == 1 and (n / k < 2)) or k > n or (n - k == 1):
		print('NO')
	elif n % 2 == 1 and k % 2 == 1:
		for i in range(k - 1):
			num.append(1)
		num.append(n - (k - 1))
		print('YES')
		print(' '.join((str(i) for i in num)))
	elif n % 2 == 0 and k % 2 == 1:
		for i in range(k - 1):
			num.append(2)
		num.append(n - (k - 1) * 2)
		print('YES')
		print(' '.join((str(i) for i in num)))
	else:
		for i in range(k - 1):
			num.append(1)
		num.append(n - (k - 1))
		print('YES')
		print(' '.join((str(i) for i in num)))


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a % 2 == 1 and b % 2 == 0 or b > a:
		print('no')
	elif a % 2 == 0 and b % 2 == 1 and (a >= b * 2):
		print('yes')
		print('2 ' * (b - 1) + str(a - (b - 1) * 2))
	elif a % 2 == 1 and b % 2 == 1 or (a % 2 == 0 and b % 2 == 0):
		print('yes')
		print('1 ' * (b - 1) + str(a - b + 1))
	else:
		print('no')


for _ in range(int(input())):
	(n, k) = [int(__) for __ in input().split()]
	if (n - k + 1) % 2 == 1 and n - k + 1 > 0:
		print('YES')
		print('1 ' * (k - 1) + str(n - k + 1))
		continue
	if (n - 2 * k + 2) % 2 == 0 and n - 2 * k + 2 > 0:
		print('YES')
		print('2 ' * (k - 1) + str(n - 2 * k + 2))
		continue
	else:
		print('NO')


t = int(input())
while t > 0:
	(n, k) = [int(ele) for ele in input().split()]
	n1 = n - (k - 1)
	n2 = n - 2 * (k - 1)
	if n1 > 0 and n1 % 2 != 0:
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(n1)
	elif n2 > 0 and n2 % 2 == 0:
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		print(n2)
	else:
		print('NO')
	t -= 1


def RA():
	return list(map(int, input().split()))

def solve():
	(n, k) = RA()
	if k == 1:
		print('YES')
		print(n)
		return
	if n < k:
		print('NO')
		return
	if n % 2 == 0:
		if k % 2 == 1:
			if n - 2 * (k - 1) < 1:
				print('NO')
			else:
				print('YES')
				print(*[2] * (k - 1) + [n - 2 * (k - 1)])
		else:
			print('YES')
			print(*[1] * (k - 1) + [n - (k - 1)])
	elif k % 2 == 0:
		print('NO')
	else:
		print('YES')
		print(*[1] * (k - 1) + [n - (k - 1)])
t = int(input())
for i in range(t):
	solve()


t = int(input())
for i in range(t):
	(k, n) = map(int, input().split())
	a = []
	if n == 1:
		print('YES')
		print(k)
	elif k - n == 1:
		print('NO')
	elif k % 2 == 1 and n % 2 == 0:
		print('NO')
	elif k - n < 0:
		print('NO')
	elif k % 2 == 0:
		if n % 2 == 1:
			if (n - 1) * 2 < k:
				for i in range(n - 1):
					a.append(2)
				print('YES')
				a.append(k - (n - 1) * 2)
				print(*a)
			else:
				print('NO')
		else:
			for i in range(n - 1):
				a.append(1)
			a.append(k - (n - 1))
			print('YES')
			print(*a)
	else:
		print('YES')
		for i in range(n - 1):
			a.append(1)
		a.append(k - (n - 1))
		print(*a)


n = int(input())
for x in range(n):
	(t, q) = list(map(int, input().split()))
	if t < q:
		print('NO')
	elif t % 2 == 0:
		if q <= t // 2:
			print('YES')
			print(t - 2 * (q - 1), end=' ')
			for ty in range(q - 1):
				print(2, end=' ')
			print()
		elif q % 2 != 0:
			print('NO')
		else:
			print('YES')
			print(t - 1 * (q - 1), end=' ')
			for tz in range(q - 1):
				print(1, end=' ')
			print()
	elif q % 2 == 0:
		print('NO')
	else:
		print('YES')
		print(t - 1 * (q - 1), end=' ')
		for tz in range(q - 1):
			print(1, end=' ')
		print()


t = int(input())
i = 0
while i < t:
	(n, k) = map(int, input().split())
	a = False
	b = False
	r = False
	q = [1] * k
	if sum(q) == n:
		a = True
		print('YES')
		for x in q:
			print(x, end=' ')
	elif sum(q) > n:
		r = True
	else:
		s = n - k
		if s % 2 == 0:
			print('YES')
			a = True
			q[k - 1] = q[k - 1] + s
			for x in q:
				print(x, end=' ')
			print()
		else:
			r = True
	if r == True:
		p = [2] * k
		if sum(p) == n:
			b = True
			print('YES')
			for x in p:
				print(x, end=' ')
			print()
		elif sum(p) > n:
			pass
		else:
			s = n - 2 * k
			if s % 2 == 0:
				b = True
				print('YES')
				p[k - 1] = p[k - 1] + s
				for x in p:
					print(x, end=' ')
				print()
			else:
				pass
	if a == False and b == False:
		print('NO')
	i = i + 1


def process(n, k):
	if n % 2 == 1 and k % 2 == 0 or k > n or (n % 2 == 0 and 2 * k > n and (k % 2 == 1)):
		print('NO')
		return
	print('YES')
	if n % 2 == 0 and k % 2 == 1:
		a = 2
	else:
		a = 1
	for i in range(k - 1):
		print(a, end=' ')
	print(n - a * (k - 1))
	return
T = int(input())
for i in range(T):
	data = input().split()
	(n, k) = (int(data[0]), int(data[1]))
	process(n, k)


c = int(input())
n = []
for i in range(c):
	n.append(list(map(int, input().split())))

def find_pairs(x):
	val = x[0]
	cou = x[1]
	i = cou
	r = []
	if val % 2 == cou % 2:
		while i != 1:
			r.append(1)
			i -= 1
		t = val - sum(r)
		if t < 1:
			return False
		if t % 2 == 1:
			r.append(t)
			return r
		else:
			return False
	else:
		while i != 1:
			r.append(2)
			i -= 1
		t = val - sum(r)
		if t < 1:
			return False
		if t % 2 == 0:
			r.append(t)
			return r
		else:
			return False
for i in n:
	fp = find_pairs(i)
	if fp:
		print('YES')
		print(' '.join(list(map(str, fp))))
	else:
		print('NO')


num = int(input())
for i in range(num):
	(t, k) = map(int, input().split(' '))
	res = list()
	if t % 2 == 0:
		if t / 2 < k:
			if t - (k - 1) > 0 and (t - (k - 1)) % 2 == 1:
				print('YES')
				for j in range(k - 1):
					res.append(str('1'))
				res.append(str(t - (k - 1)))
				print(' '.join([str(h) for h in res]))
			else:
				print('NO')
		else:
			for j in range(k - 1):
				res.append('2')
				t -= 2
			res.append(str(t))
			print('YES')
			print(' '.join([str(h) for h in res]))
	elif t - (k - 1) > 0 and (t - (k - 1)) % 2 == 1:
		print('YES')
		for j in range(k - 1):
			res.append(str('1'))
		res.append(str(t - (k - 1)))
		print(' '.join([str(h) for h in res]))
	else:
		print('NO')


def parity(n, k):
	l = []
	if n < k:
		return ('NO', [])
	if n % 2 != 0:
		if k % 2 == 0:
			ans = 'NO'
			return (ans, l)
		l = [1] * (k - 1)
		l.append(n - k + 1)
		ans = 'YES'
		return (ans, l)
	elif n % 2 == 0:
		if n // 2 >= k:
			l = [2] * (k - 1)
			l.append(n - 2 * (k - 1))
			ans = 'YES'
			return (ans, l)
		elif k % 2 == 0:
			l = [1] * (k - 1)
			l.append(n - k + 1)
			ans = 'YES'
			return (ans, l)
		else:
			ans = 'NO'
			return (ans, l)
T = int(input())
for i in range(T):
	(n, k) = [int(j) for j in input().split()]
	(a, b) = parity(n, k)
	if a == 'NO':
		print(a)
	else:
		print(a)
		for j in b:
			print(j, end=' ')
		print()


t = input()
t = int(t)
while t > 0:
	line = input()
	i = line.split()
	x = int(i[0])
	y = int(i[1])
	o = x - (y - 1)
	if o % 2 == 1 and o > 0:
		print('YES')
		for j in range(y - 1):
			print('1', end=' ')
		print(o)
		t = t - 1
		continue
	e = x - (y - 1) * 2
	if e % 2 == 0 and e > 0:
		print('YES')
		for j in range(y - 1):
			print('2', end=' ')
		print(e)
	else:
		print('NO')
	t = t - 1


t = int(input())
while t:
	(n, k) = map(int, input().split())
	if n < k:
		print('NO')
	else:
		a = n // k
		if a * k == n:
			print('YES')
			s = (str(a) + ' ') * k
			print(s)
		else:
			c = 0
			l = [a] * k
			n = n - a * k
			if (n + a) % 2 == 0 and a % 2 == 0 or ((n + a) % 2 != 0 and a % 2 != 0):
				print('YES')
				l[0] += n
				s = ''
				for i in l:
					s += str(i) + ' '
				print(s)
			else:
				i = 0
				while n != 0:
					l[i % k] += 1
					i += 1
					n -= 1
				while i < len(l):
					if i == len(l) - 1:
						c = 1
						break
					else:
						l[i + 1] += 1
						l[i] -= 1
						i += 2
				if c == 1:
					print('NO')
				else:
					c = 0
					s = ''
					for i in l:
						if i != 0:
							s += str(i) + ' '
						else:
							c = 1
							break
					if c == 1:
						print('NO')
					else:
						print('YES')
						print(s)
	t -= 1


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	n1 = n - (k - 1)
	if n1 > 0 and n1 % 2 == 1:
		print('YES')
		ch1 = ''
		for i in range(k - 1):
			ch1 += '1 '
		print(ch1 + str(n1))
		continue
	n2 = n - 2 * (k - 1)
	if n2 > 0 and n2 % 2 == 0:
		print('YES')
		ch2 = ''
		for i in range(k - 1):
			ch2 += '2 '
		print(ch2 + str(n2))
		continue
	print('NO')


import sys
try:
	sys.stdin = open('Input.txt', 'r')
	sys.stdout = open('Output.txt', 'w')
except:
	pass
input = sys.stdin.readline
for testCases in range(int(input())):
	(m, k) = map(int, input().split())
	if (m - k + 1) % 2 == 1 and m - k + 1 > 0:
		print('YES')
		ans = [1] * k
		ans[-1] = m - k + 1
		print(*ans, sep=' ')
		continue
	elif (m - 2 * (k - 1)) % 2 == 0 and m - 2 * (k - 1) > 0:
		print('YES')
		ans = [2] * k
		ans[-1] = m - 2 * (k - 1)
		print(*ans, sep=' ')
		continue
	print('NO')


t = int(input())
for i in range(t):
	(n, k) = [int(i) for i in input().split()]
	if n % 2 == 0:
		if k % 2 == 0:
			if n < k:
				print('NO')
			else:
				res = [1 for i in range(k)]
				res[-1] += n - k
				print('YES')
				print(' '.join(map(str, res)))
		elif n < 2 * k:
			print('NO')
		else:
			res = [2 for i in range(k)]
			res[-1] += n - 2 * k
			print('YES')
			print(' '.join(map(str, res)))
	elif k % 2 == 0:
		print('NO')
	elif n < k:
		print('NO')
	else:
		res = [1 for i in range(k)]
		res[-1] += n - k
		print('YES')
		print(' '.join(map(str, res)))


t = int(input())

def is_chet(n, k):
	for __ in range(k - 1):
		n -= 2
	if n % 2 == 0 and n > 0:
		return True

def print_chet(n, k):
	print('YES')
	print((k - 1) * '2 ' + str(n - 2 * (k - 1)))

def is_nechet(n, k):
	for __ in range(k - 1):
		n -= 1
	if n % 2 == 1 and n > 0:
		return True

def print_nechet(n, k):
	print('YES')
	print((k - 1) * '1 ' + str(n - (k - 1)))
for _ in range(t):
	(n, k) = map(int, input().split())
	if is_chet(n, k):
		print_chet(n, k)
	elif is_nechet(n, k):
		print_nechet(n, k)
	else:
		print('NO')


for t in range(int(input())):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
		continue
	f = 0
	v = n % k
	if v:
		if (1 + n - k) % 2:
			a = [1] * k
			a[0] += n - k
			f = 1
		if (2 + n - 2 * k) % 2 == 0 and n > 2 * k:
			a = [2] * k
			a[0] += n - 2 * k
			f = 1
	else:
		a = [n // k] * k
		f = 1
	if f:
		print('YES')
		print(*a)
	else:
		print('NO')


import sys
input = lambda : sys.stdin.readline().strip()
for i in range(int(input())):
	(n, k) = map(int, input().split())
	if n < k:
		print('NO')
	elif k == n:
		print('YES')
		print('1 ' * n)
	else:
		l1 = []
		l2 = []
		x = n
		y = n
		for i in range(k - 1):
			l1.append(1)
			l2.append(2)
			x -= 1
			y -= 2
		l1.append(x)
		l2.append(y)
		if l1[-1] > 0 and l1[-1] % 2 == 1:
			print('YES')
			print(*l1)
		elif l2[-1] > 0 and l2[-1] % 2 == 0:
			print('YES')
			print(*l2)
		else:
			print('NO')


for t in range(int(input())):
	(n, k) = map(int, input().split())
	f = 0
	a = []
	if k == 1:
		f = 1
		a.append(n)
	elif n % 2 != 0 and k % 2 == 0 or n < k or k == n - 1:
		f = 0
	else:
		f = 1
		if n % 2 == 0 and k % 2 != 0:
			a = [2] * (k - 1)
			s = 2 * (k - 1)
			if n - s <= 0:
				f = 0
			else:
				a.append(n - s)
		else:
			a = [1] * (k - 1)
			s = k - 1
			a.append(n - s)
	if f == 0:
		print('NO')
	else:
		print('YES')
		print(*a, sep=' ')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n % 2 == 0 and k % 2 == 0:
		arr = [1] * (k - 1) + [n - (k - 1)]
		if min(arr) <= 0:
			print('NO')
		else:
			print('YES')
			print(*arr)
		continue
	if n % 2 == 0:
		arr = [2] * (k - 1) + [n - 2 * (k - 1)]
		if min(arr) <= 0:
			print('NO')
		else:
			print('YES')
			print(*arr)
		continue
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
		continue
	arr = [1] * (k - 1) + [n - (k - 1)]
	if min(arr) <= 0:
		print('NO')
	else:
		print('YES')
		print(*arr)


for _ in range(int(input())):
	(n, k) = [int(i) for i in input().split()]
	if n >= k:
		if n % 2 == 0:
			if k % 2 == 1 and n >= k * 2:
				print('yes')
				for i in range(k - 1):
					n = n - 2
					print(2, end=' ')
				print(n)
			elif k % 2 == 0:
				print('yes')
				for i in range(k - 1):
					n = n - 1
					print(1, end=' ')
				print(n)
			else:
				print('no')
		elif k % 2 == 0:
			print('no')
		else:
			print('yes')
			for i in range(k - 1):
				n = n - 1
				print(1, end=' ')
			print(n)
	else:
		print('no')


t = int(input())

def solve():
	(n, k) = map(int, input().split())
	x = n - k + 1
	if x % 2 == 1 and x > 0:
		ans = [1] * (k - 1) + [x]
		return ('YES', ans)
	x = n - 2 * (k - 1)
	if x % 2 == 0 and x > 0:
		ans = [2] * (k - 1) + [x]
		return ('YES', ans)
	return ('NO', 1)
for i in range(t):
	(a, ans) = solve()
	print(a)
	if a == 'YES':
		print(*ans)


for _ in ' ' * int(input()):
	from math import floor as z
	(a, b) = map(int, input().split())
	if b == 1:
		print('YES')
		print(a)
	elif a < b:
		print('NO')
	elif b == 2 and b & 1 != a & 1 or a - b == 1:
		print('NO')
	elif a == b:
		print('YES')
		print('1 ' * a)
	elif a & 1 == b & 1:
		print('YES')
		print('1 ' * (b - 1) + str(a - b + 1))
	elif a // 2 >= b and a & 1 != 1:
		print('YES')
		print('2 ' * (b - 1) + str(a - 2 * (b - 1)))
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	ans = n
	ans -= (k - 1) * 2
	if ans > 0 and ans % 2 == 0:
		print('YES')
		print('2 ' * (k - 1) + str(ans))
		continue
	ans = n
	ans -= k - 1
	if ans > 0 and ans % 2 != 0:
		print('YES')
		print('1 ' * (k - 1) + str(ans))
		continue
	print('NO')


import math
import sys
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	b = n - 2 * (k - 1)
	if b % 2 == 0 and b > 0:
		print('YES')
		for i in range(0, k - 1):
			print(2, end=' ')
		print(b)
	else:
		b = n - (k - 1)
		if b % 2 == 1 and b > 0:
			print('YES')
			for i in range(0, k - 1):
				print(1, end=' ')
			print(b)
		else:
			print('NO')


from math import floor
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	p = 2 * (k - 1)
	if n - p > 0 and (n - p) % 2 == 0:
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		print(n - p)
	elif n - k + 1 > 0 and (n - k + 1) % 2 != 0:
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(n - k + 1)
	else:
		print('NO')


t = int(input())
for tests in range(t):
	(n, k) = map(int, input().split())
	if n % 2 == 1 and k % 2 == 0 or k > n:
		print('NO')
		continue
	if n % 2 == 0:
		if k % 2 == 1:
			p = n - 2 * (k - 1)
			if p > 0:
				print('YES')
				print(str(p) + ' ' + '2 ' * (k - 1))
			else:
				print('NO')
		else:
			p = n - k + 1
			if p > 0:
				print('YES')
				print(str(p) + ' ' + '1 ' * (k - 1))
			else:
				print('NO')
	elif k % 2 == 0:
		print('NO')
	else:
		p = n - k + 1
		if p > 0:
			print('YES')
			print(str(p) + ' ' + '1 ' * (k - 1))
		else:
			print('NO')


t = int(input())
for i in range(t):
	(n, k) = list(map(int, input().split()))
	a = n - (k - 1)
	if a > 0 and a % 2 == 1:
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(a)
		continue
	b = n - 2 * (k - 1)
	if b > 0 and b % 2 == 0:
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		print(b)
		continue
	print('NO')


t = int(input())
for u in range(t):
	(n, k) = list(map(int, input().split()))
	deff = 0
	res = ''
	if n % 2 == 0 and k % 2 == 1:
		if 2 * k <= n:
			for i in range(k - 1):
				res += '2 '
			res += str(n - 2 * (k - 1))
			deff = 1
	elif n % 2 == 0 and k % 2 == 0:
		if k <= n:
			for i in range(k - 1):
				res += '1 '
			res += str(n - (k - 1))
			deff = 1
	elif n % 2 == 1 and k % 2 == 1:
		if k <= n:
			for i in range(k - 1):
				res += '1 '
			res += str(n - (k - 1))
			deff = 1
	else:
		deff = 0
	if deff == 0:
		print('NO')
	else:
		print('YES')
		print(res)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	c = n // k
	f = 0
	d = n % k
	a = k % 2
	b = n % 2
	if c > 1:
		if a == 0:
			if b == 0:
				l = [1] * (k - 1)
				e = n - (k - 1)
				l.append(e)
			else:
				f = 1
		elif b == 0:
			l = [2] * (k - 1)
			e = n - 2 * (k - 1)
			l.append(e)
		else:
			l = [1] * (k - 1)
			e = n - (k - 1)
			l.append(e)
	elif c == 0:
		f = 1
	elif abs(a - b) == 0:
		l = [1] * (k - 1)
		e = n - (k - 1)
		l.append(e)
	else:
		f = 1
	if f == 1:
		print('NO')
	else:
		print('YES')
		for i in range(len(l)):
			print(l[i], end=' ')
		print()


q = int(input())
for _ in range(q):
	(n, t) = [int(x) for x in input().split()]
	sum = 0
	if t > n:
		print('NO')
		continue
	if n % 2 != 0 and t % 2 == 0:
		print('NO')
	else:
		sum = n
		ans = []
		sum -= t - 1
		pos = 0
		if sum % 2 != 0 and sum > 0:
			pos = 1
			print('YES')
			for i in range(0, t - 1):
				print(1, end=' ')
			print(sum)
		else:
			sum = n
			sum = sum - 2 * (t - 1)
			if sum % 2 == 0 and sum > 0:
				pos = 1
				print('YES')
				for i in range(0, t - 1):
					print(2, end=' ')
				print(sum)
		if pos == 0:
			print('NO')


T = int(input())
for t in range(T):
	(N, K) = [int(_) for _ in input().split()]
	if N % 2 == 1 and K % 2 == 0:
		print('NO')
		continue
	if N < K:
		print('NO')
		continue
	if (N - (K - 1)) % 2:
		print('YES')
		print(' '.join(['1'] * (K - 1) + [str(N - (K - 1))]))
	elif (N - 2 * (K - 1)) % 2 == 0:
		if N < 2 * K:
			print('NO')
			continue
		print('YES')
		print(' '.join(['2'] * (K - 1) + [str(N - 2 * (K - 1))]))
	else:
		assert False


a = int(input())
for i in range(0, a):
	(b, c) = map(int, input().split())
	if b - (c - 1) > 0 and (b - (c - 1)) % 2 == 1:
		print('YES')
		for j in range(0, c - 1):
			print(1, end=' ')
		print(b - (c - 1))
	elif b - 2 * (c - 1) > 0 and (b - 2 * (c - 1)) % 2 == 0:
		print('YES')
		for j in range(0, c - 1):
			print(2, end=' ')
		print(b - 2 * (c - 1))
	else:
		print('NO')


import math
t = int(input())
for _ in range(0, t):
	str1 = input()
	str1 = str1.split()
	n = int(str1[0])
	k = int(str1[1])
	sum1 = k - 1
	sum2 = (k - 1) * 2
	if n - sum1 > 0 and (n - sum1) % 2 == 1:
		print('YES')
		for i in range(0, k - 1):
			print(1, end=' ')
		print(n - sum1)
	elif n - sum2 > 0 and (n - sum2) % 2 == 0:
		print('YES')
		for i in range(0, k - 1):
			print(2, end=' ')
		print(n - sum2)
	else:
		print('NO')


import sys, bisect, string, math, time, functools, random
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
from itertools import permutations, combinations, groupby

def Golf():
	(*a,) = map(int, open(0))

def I():
	return int(input())

def S_():
	return input()

def IS():
	return input().split()

def LS():
	return [i for i in input().split()]

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def StoLI():
	return [ord(i) - 97 for i in input()]

def ItoS(n):
	return chr(n + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def GI(V, E, ls=None, Directed=False, index=1):
	org_inp = []
	g = [[] for i in range(V)]
	FromStdin = True if ls == None else False
	for i in range(E):
		if FromStdin:
			inp = LI()
			org_inp.append(inp)
		else:
			inp = ls[i]
		if len(inp) == 2:
			(a, b) = inp
			c = 1
		else:
			(a, b, c) = inp
		if index == 1:
			a -= 1
			b -= 1
		aa = (a, c)
		bb = (b, c)
		g[a].append(bb)
		if not Directed:
			g[b].append(aa)
	return (g, org_inp)

def GGI(h, w, search=None, replacement_of_found='.', mp_def={'#': 1, '.': 0}, boundary=1):
	mp = [boundary] * (w + 2)
	found = {}
	for i in range(h):
		s = input()
		for char in search:
			if char in s:
				found[char] = (i + 1) * (w + 2) + s.index(char) + 1
				mp_def[char] = mp_def[replacement_of_found]
		mp += [boundary] + [mp_def[j] for j in s] + [boundary]
	mp += [boundary] * (w + 2)
	return (h + 2, w + 2, mp, found)

def TI(n):
	return GI(n, n - 1)

def bit_combination(k, n=2):
	rt = []
	for tb in range(n ** k):
		s = [tb // n ** bt % n for bt in range(k)]
		rt += [s]
	return rt

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
YN = ['YES', 'NO']
Yn = ['Yes', 'No']
mo = 10 ** 9 + 7
inf = float('inf')
FourNb = [(1, 0), (-1, 0), (0, 1), (0, -1)]
EightNb = [(1, 0), (-1, 0), (0, 1), (0, -1), (1, 1), (-1, -1), (1, -1), (-1, 1)]
compas = dict(zip('EWNS', FourNb))
l_alp = string.ascii_lowercase
input = lambda : sys.stdin.readline().rstrip()

class Tree:

	def __init__(self, inp_size=None, init=True):
		self.LCA_init_stat = False
		self.ETtable = []
		if init:
			self.stdin(inp_size)
		return

	def stdin(self, inp_size=None, index=1):
		if inp_size == None:
			self.size = int(input())
		else:
			self.size = inp_size
		(self.edges, _) = GI(self.size, self.size - 1, index=index)
		return

	def listin(self, ls, index=0):
		self.size = len(ls) + 1
		(self.edges, _) = GI(self.size, self.size - 1, ls, index=index)
		return

	def __str__(self):
		return str(self.edges)

	def dfs(self, x, func=lambda prv, nx, dist: prv + dist, root_v=0):
		q = deque()
		q.append(x)
		v = [-1] * self.size
		v[x] = root_v
		while q:
			c = q.pop()
			for (nb, d) in self.edges[c]:
				if v[nb] == -1:
					q.append(nb)
					v[nb] = func(v[c], nb, d)
		return v

	def EulerTour(self, x):
		q = deque()
		q.append(x)
		self.depth = [None] * self.size
		self.depth[x] = 0
		self.ETtable = []
		self.ETdepth = []
		self.ETin = [-1] * self.size
		self.ETout = [-1] * self.size
		cnt = 0
		while q:
			c = q.pop()
			if c < 0:
				ce = ~c
			else:
				ce = c
				for (nb, d) in self.edges[ce]:
					if self.depth[nb] == None:
						q.append(~ce)
						q.append(nb)
						self.depth[nb] = self.depth[ce] + 1
			self.ETtable.append(ce)
			self.ETdepth.append(self.depth[ce])
			if self.ETin[ce] == -1:
				self.ETin[ce] = cnt
			else:
				self.ETout[ce] = cnt
			cnt += 1
		return

	def LCA_init(self, root):
		self.EulerTour(root)
		self.st = SparseTable(self.ETdepth, init_func=min, init_idl=inf)
		self.LCA_init_stat = True
		return

	def LCA(self, root, x, y):
		if self.LCA_init_stat == False:
			self.LCA_init(root)
		(xin, xout) = (self.ETin[x], self.ETout[x])
		(yin, yout) = (self.ETin[y], self.ETout[y])
		a = min(xin, yin)
		b = max(xout, yout, xin, yin)
		id_of_min_dep_in_et = self.st.query_id(a, b + 1)
		return self.ETtable[id_of_min_dep_in_et]

class SparseTable:

	def __init__(self, ls, init_func=min, init_idl=float('inf')):
		self.func = init_func
		self.idl = init_idl
		self.size = len(ls)
		self.N0 = self.size.bit_length()
		self.table = [ls[:]]
		self.index = [list(range(self.size))]
		self.lg = [0] * (self.size + 1)
		for i in range(2, self.size + 1):
			self.lg[i] = self.lg[i >> 1] + 1
		for i in range(self.N0):
			tmp = [self.func(self.table[i][j], self.table[i][min(j + (1 << i), self.size - 1)]) for j in range(self.size)]
			tmp_id = [self.index[i][j] if self.table[i][j] == self.func(self.table[i][j], self.table[i][min(j + (1 << i), self.size - 1)]) else self.index[i][min(j + (1 << i), self.size - 1)] for j in range(self.size)]
			self.table += [tmp]
			self.index += [tmp_id]

	def query(self, l, r):
		r = min(self.size, r)
		N = self.lg[r - l]
		return self.func(self.table[N][l], self.table[N][r - (1 << N)])

	def query_id(self, l, r):
		N = self.lg[r - l]
		(a, b) = (self.index[N][l], self.index[N][r - (1 << N)])
		if self.table[0][a] == self.func(self.table[N][l], self.table[N][r - (1 << N)]):
			b = a
		return b

	def __str__(self):
		return str(self.table[0])

	def print(self):
		for i in self.table:
			print(*i)
show_flg = False
show_flg = True
ans = 0
T = I()
for _ in range(T):
	(n, k) = LI()
	a = [1] * (k - 1) + [n - k + 1]
	if a[-1] % 2 == 1 and a[-1] > 0:
		print('YES')
		print(*a)
		continue
	a = [2] * (k - 1) + [n - 2 * (k - 1)]
	if a[-1] % 2 == 0 and a[-1] > 0:
		print('YES')
		print(*a)
		continue
	print('NO')


a = int(input())
for i in range(a):
	(a, b) = map(int, input().split())
	l = []
	if a % 2 != 0 and b % 2 == 0:
		print('NO')
	elif a % 2 == 0 and b % 2 != 0:
		if a - (b - 1) * 2 <= 0:
			print('NO', end=' ')
		else:
			print('YES')
			l = [2 for j in range(b - 1)]
			l.append(a - (b - 1) * 2)
		for v in l:
			print(v, end=' ')
		print(end='\n')
	elif a % 2 != 0 and b % 2 != 0:
		if a - (b - 1) <= 0:
			print('NO', end=' ')
		else:
			print('YES')
			l = [1 for j in range(b - 1)]
			l.append(a - (b - 1))
		for v in l:
			print(v, end=' ')
		print(end='\n')
	elif a % 2 == 0 and b % 2 == 0:
		if a - (b - 1) * 2 <= 0 and a - (b - 1) <= 0:
			print('NO', end=' ')
		else:
			print('YES')
			if a - (b - 1) * 2 <= 0:
				l = [1 for j in range(b - 1)]
				l.append(a - (b - 1))
			elif a - (b - 1) <= 0:
				l = [2 for j in range(b - 1)]
				l.append(a - (b - 1) * 2)
			else:
				l = [1 for j in range(b - 1)]
				l.append(a - (b - 1))
		for v in l:
			print(v, end=' ')
		print(end='\n')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
		continue
	if n % 2 == 0:
		if k <= n // 2:
			print('YES')
			elements = [2] * k
			elements[-1] = n - sum(elements[:-1])
			print(*elements)
		elif k % 2:
			print('NO')
		else:
			print('YES')
			elements = [1] * k
			elements[-1] = n - sum(elements[:-1])
			print(*elements)
	else:
		if k % 2 == 0:
			print('NO')
			continue
		print('YES')
		elements = [1] * k
		elements[-1] = n - sum(elements[:-1])
		print(*elements)


from math import *
from collections import *
from operator import itemgetter
import bisect
ii = lambda : int(input())
iia = lambda : list(map(int, input().split()))
isa = lambda : list(input().split())
I = lambda : list(map(int, input().split()))
chrIdx = lambda x: ord(x) - 96
idxChr = lambda x: chr(96 + x)
t = ii()
for _ in range(t):
	(n, k) = iia()
	if n % 2 == 1:
		if (n - k + 1) % 2 == 1 and n - k + 1 > 0:
			print('YES')
			print('1 ' * (k - 1) + str(n - k + 1))
		else:
			print('NO')
	elif n % 2 == 0:
		if n - 2 * (k - 1) > 1 and (n - 2 * (k - 1)) % 2 == 0:
			print('YES')
			print('2 ' * (k - 1) + str(n - 2 * (k - 1)))
		elif (n - k + 1) % 2 == 1 and n - k + 1 > 0:
			print('YES')
			print('1 ' * (k - 1) + str(n - k + 1))
		else:
			print('NO')


for ii in range(int(input())):
	(n, k) = map(int, input().split())
	if n % 2 == 1 and k % 2 == 0 or n < k:
		print('NO')
	elif n % 2 == 1:
		ans = [1 for i in range(k - 1)]
		ans.append(n - k + 1)
		print('YES')
		print(*ans)
	elif k % 2 == 0:
		ans = [1 for i in range(k - 1)]
		ans.append(n - k + 1)
		print('YES')
		print(*ans)
	elif k * 2 > n:
		print('NO')
	else:
		ans = [2 for i in range(k - 1)]
		ans.append(n - 2 * k + 2)
		print('YES')
		print(*ans)


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	if n % 2 == 0:
		if x % 2 == 1:
			a = 2 * x
			if a > n:
				print('NO')
			else:
				print('YES')
				print('2 ' * (x - 1) + str(n - 2 * (x - 1)))
		else:
			a = x
			if a > n:
				print('NO')
			else:
				print('YES')
				print('1 ' * (x - 1) + str(n - (x - 1)))
	elif x % 2 == 0:
		print('NO')
	else:
		a = x
		if a > n:
			print('NO')
		else:
			print('YES')
			print('1 ' * (x - 1) + str(n - (x - 1)))


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	(n, k) = map(int, sys.stdin.readline().split())
	yes = False
	if (n - (k - 1) * 2) % 2 == 0 and k * 2 <= n:
		yes = True
		out = [2] * (k - 1)
		out.append(n - (k - 1) * 2)
	elif (n - (k - 1)) % 2 != 0 and k <= n:
		yes = True
		out = [1] * (k - 1)
		out.append(n - k + 1)
	if yes:
		print('YES')
		print(' '.join([str(x) for x in out]))
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	x = []
	if k > n:
		print('NO')
		continue
	if n % 2 == 0 and k % 2 == 0:
		if k > n // 2:
			for i in range(k - 1):
				x.append(1)
			y = n - (k - 1) * 1
			x.append(y)
			print('YES')
			print(*x)
		else:
			for i in range(k - 1):
				x.append(2)
			y = n - (k - 1) * 2
			x.append(y)
			print('YES')
			print(*x)
	elif n % 2 == 0 and k % 2 == 1:
		if k > n // 2:
			print('NO')
		else:
			for i in range(k - 1):
				x.append(2)
			y = n - (k - 1) * 2
			x.append(y)
			print('YES')
			print(*x)
	elif n % 2 == 1 and k % 2 == 0:
		print('NO')
	elif n % 2 == 1 and k % 2 == 1:
		for i in range(k - 1):
			x.append(1)
		y = n - (k - 1) * 1
		x.append(y)
		print('YES')
		print(*x)


t = int(input())
for _C in range(t):
	(n, k) = map(int, input().split())
	if k % 2 == 0 and n % 2 == 1 or k > n:
		print('NO')
		continue
	if k % 2 == 0 and n % 2 == 0:
		if k > n:
			print('NO')
			continue
		else:
			print('YES')
			print('1 ' * (k - 1) + str(n - k + 1))
	if k % 2 == 1:
		if n % 2 == 1:
			if n - k + 1 <= 0:
				print('NO')
				continue
			print('YES')
			print('1 ' * (k - 1) + str(n - k + 1))
		else:
			if n - 2 * k + 2 <= 0:
				print('NO')
				continue
			print('YES')
			print('2 ' * (k - 1) + str(n - 2 * k + 2))


import math
from collections import Counter, deque
L = lambda : list(map(int, input().split()))
M = lambda : map(int, input().split())
I = lambda : int(input())
IN = lambda : input()
mod = 10 ** 9 + 7

def s(a):
	print(' '.join(list(map(str, a))))
for i in range(I()):
	(n, k) = M()
	if k > n:
		print('NO')
	else:
		x = n - k + 1
		if x % 2 == 1:
			print('YES')
			print(x, '1 ' * (k - 1))
		else:
			y = x - (k - 1)
			if y % 2 == 0 and y > 1:
				print('YES')
				print(x - (k - 1), '2 ' * (k - 1))
			else:
				print('NO')


for i in range(int(input())):
	(n, k) = list(map(int, input().split()))
	if n - k + 1 > 0 and (n - k + 1) % 2 == 1:
		print('yes')
		res = [1] * (k - 1) + [n - k + 1]
		print(*res)
	elif n - 2 * (k - 1) > 0 and (n - 2 * (k - 1)) % 2 == 0:
		print('yes')
		res = [2] * (k - 1) + [n - 2 * (k - 1)]
		print(*res)
	else:
		print('no')


t = int(input())
for i in range(t):
	(n, k) = [int(x) for x in input().split()]
	l1 = [2] * (k - 1)
	m1 = n - sum(l1)
	l2 = [1] * (k - 1)
	m2 = n - sum(l2)
	if m1 < 0 and m2 < 0:
		print('NO')
	elif m1 < 0 and m2 % 2 == 1:
		print('YES')
		l2.append(m2)
		print(*l2)
	elif m2 < 0 and m1 % 2 == 0:
		print('YES')
		l1.append(m1)
		print(*l1)
	elif not m1 % 2 and m1 > 0:
		print('YES')
		l1.append(m1)
		print(*l1)
	elif m2 % 2 and m2 > 0:
		print('YES')
		l2.append(m2)
		print(*l2)
	else:
		print('NO')


tests = int(input())
for i in range(tests):
	(n, k) = map(int, input().split())
	if n % 2 == 0 and k % 2 != 0:
		if k * 2 > n:
			print('NO')
		else:
			print('YES')
			d = [2 + n - k * 2] + [2] * (k - 1)
			print(*d)
	if n % 2 == 0 and k % 2 == 0:
		if k > n:
			print('NO')
		else:
			print('YES')
			d = [1 + n - k] + [1] * (k - 1)
			print(*d)
	if n % 2 != 0 and k % 2 != 0:
		if k > n:
			print('NO')
		else:
			print('YES')
			d = [1 + n - k] + [1] * (k - 1)
			print(*d)
	if n % 2 != 0 and k % 2 == 0:
		print('NO')


counter = int(input())
for _ in range(counter):
	(n, k) = [int(x) for x in input().split()]
	r = n - 1 * (k - 1)
	if r > 0 and r % 2 != 0:
		l = [1] * (k - 1) + [r]
		l = [str(x) for x in l]
		print('YES')
		print(' '.join(l))
		continue
	r = n - 2 * (k - 1)
	if r > 0 and r % 2 == 0:
		l = [2] * (k - 1) + [r]
		l = [str(x) for x in l]
		print('YES')
		print(' '.join(l))
	else:
		print('NO')


import sys
import math as mt

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def printwsp(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')

def printchk(*args):
	return print(*args, end='tst, ')
MOD = int(1000000000.0 + 7)
BABYMOD = 998244353
for _testcases_ in range(int(input())):
	(n, k) = get_ints()
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
	elif k > n:
		print('NO')
	elif n % 2 == 1:
		print('YES')
		rem = n
		for i in range(k):
			if i == k - 1:
				print(rem)
			else:
				printsp(1)
				rem -= 1
	elif n % 2 == 0:
		if k % 2 == 0:
			rem = n
			print('YES')
			for i in range(k):
				if i == k - 1:
					print(rem)
				else:
					printsp(1)
					rem -= 1
		elif n >= 2 * k:
			print('YES')
			rem = n
			for i in range(k):
				if i == k - 1:
					print(rem)
				else:
					printsp(2)
					rem -= 2
		else:
			print('NO')


t = int(input())
r = []
for i in range(t):
	(n, k) = map(int, input().split())
	z1 = n - (k - 1)
	z2 = n - 2 * (k - 1)
	if z1 > 0 and z1 % 2 == 1:
		print('YES')
		for j in range(k - 1):
			print(1, end=' ')
		print(z1)
	elif z2 > 0 and z2 % 2 == 0:
		print('YES')
		for j in range(k - 1):
			print(2, end=' ')
		print(z2)
	else:
		print('NO')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if k <= n and (n - (k - 1)) % 2 == 1:
		print('YES')
		out = [1 for i in range(k - 1)] + [n - (k - 1)]
		print(*out)
	elif n - (k - 1) * 2 > 0 and (n - (k - 1) * 2) % 2 == 0:
		print('YES')
		out = [2 for i in range(k - 1)] + [n - (k - 1) * 2]
		print(*out)
	else:
		print('NO')


import sys
input = sys.stdin.readline
T = int(input())
for _ in range(0, T):
	(N, K) = list(map(int, input().split(' ')))
	onesum = 1 * (K - 1)
	twosum = 2 * (K - 1)
	oneremain = N - onesum
	tworemain = N - twosum
	if oneremain < 0 and tworemain < 0:
		print('NO')
		continue
	if tworemain % 2 == 0 and tworemain > 0:
		print('YES')
		outstring = ''
		for i in range(0, K - 1):
			outstring += '2 '
		if tworemain == 0:
			print(outstring.strip())
		else:
			outstring += str(tworemain)
			print(outstring)
		continue
	elif oneremain % 2 == 1 and oneremain > 0:
		print('YES')
		outstring = ''
		for i in range(0, K - 1):
			outstring += '1 '
		outstring += str(oneremain)
		print(outstring)
		continue
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	(n, k) = [int(e) for e in input().split()]
	if n % 2 == 1 and k % 2 == 0 or n < k:
		print('NO')
	elif n % 2 == 1 or (n % 2 == 0 and k % 2 == 0):
		print('YES')
		for i in range(0, k - 1):
			print('1', end=' ')
		print(n - k + 1)
	elif n < 2 * k:
		print('NO')
	else:
		print('YES')
		for i in range(0, k - 1):
			print('2', end=' ')
		print(n - 2 * (k - 1))


res = []
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n % 2 == 1 and (k % 2 == 0 or n < k) or (n % 2 == 0 and (k % 2 == 1 and n < 2 * k or (k % 2 == 0 and n < k))):
		res.append(['NO'])
	elif n % k == 0:
		res.append(['YES', [n // k for _ in range(k)]])
	else:
		r = []
		s = n // k
		o = n % k
		if o % 2 == 0:
			r = [s for _ in range(k - 1)]
			r.append(s + o)
		else:
			r = [s + 1 for _ in range(o)]
			for _ in range((k - o) // 2):
				r.append(s + 1)
				r.append(s - 1)
		res.append(['YES', r])
for i in res:
	print(i[0])
	if len(i) > 1:
		print(*i[1])


import sys
T = int(sys.stdin.readline())
for _ in range(T):
	(n, k) = map(int, sys.stdin.readline().split())
	if not n % 2 and k % 2:
		key = 2
	elif n % 2 and (not k % 2):
		print('NO')
		continue
	elif n % 2 and k % 2:
		key = 1
	elif n > k * 2:
		key = 2
	else:
		key = 1
	result = []
	for count in range(1, k + 1):
		if n < 0:
			result = []
			break
		if count == k:
			if n % 2 == key % 2 and n:
				result.append(n)
			else:
				result = []
			continue
		result.append(key)
		n -= key
	if result:
		print('YES')
		print(*result)
	else:
		print('NO')


tt = int(input())
for i in range(tt):
	(n, k) = [int(x) for x in input().split()]
	ans = []
	t = 1
	if n % 2 == 0 and k % 2 != 0:
		for i in range(k - 1):
			ans.append(2)
		if (n - 2 * (k - 1)) % 2 != 0 or n - 2 * (k - 1) <= 0:
			t = 0
		else:
			ans.append(n - 2 * (k - 1))
	else:
		for i in range(k - 1):
			ans.append(1)
		if (n - (k - 1)) % 2 == 0 or n - (k - 1) <= 0:
			t = 0
		else:
			ans.append(n - (k - 1))
	if t == 0:
		print('NO')
	else:
		print('YES')
		print(*ans)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	odd = n + 1 - k
	eve = n - 2 * (k - 1)
	if odd > 0 and odd % 2 == 1:
		print('YES')
		print('1 ' * (k - 1), n + 1 - k, sep='')
		continue
	if eve > 0 and eve % 2 == 0:
		print('YES')
		print('2 ' * (k - 1), n - 2 * (k - 1), sep='')
		continue
	print('NO')


def summands_Parity(n, k):
	ans = []
	if n < k:
		print('NO')
		return
	elif k % 2 == 0 and n % 2 != 0:
		print('NO')
		return
	elif k == 1:
		print('YES')
		print(n)
		return
	for i in range(n - 1, 0, -1):
		if i % 2 == 0:
			if i + (k - 1) * 2 == n:
				print('YES')
				print(i, '2 ' * (k - 1))
				return
		elif i + (k - 1) * 1 == n:
			print('YES')
			print(i, '1 ' * (k - 1))
			return
	print('NO')
t = int(input())
for w in range(t):
	x = input().split()
	(n, k) = (int(x[0]), int(x[1]))
	summands_Parity(n, k)


t = int(input())
for i in range(t):
	(n, k) = [int(x) for x in input().split()]
	if k > n:
		print('NO')
	elif (n - k + 1) % 2 == 1:
		print('YES')
		print((str(1) + ' ') * (k - 1) + str(n - k + 1))
	elif (n - (k - 1) * 2) % 2 == 0 and n - (k - 1) * 2 > 0:
		print('YES')
		print((str(2) + ' ') * (k - 1) + str(n - (k - 1) * 2))
	else:
		print('NO')


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
import sys

def solve(n, k):
	if n % 2 == 0:
		if k % 2 == 0:
			if n < k:
				return 'NO'
			Ans = [1] * (k - 1) + [n - (k - 1)]
			return Ans
		else:
			if n < 2 * k:
				return 'NO'
			Ans = [2] * (k - 1) + [n - 2 * (k - 1)]
			return Ans
	else:
		if k % 2 == 0:
			return 'NO'
		if n < k:
			return 'NO'
		Ans = [1] * (k - 1) + [n - (k - 1)]
		return Ans

def main():
	t = int(input())
	for _ in range(t):
		(n, k) = map(int, input().split())
		ans = solve(n, k)
		if ans == 'NO':
			sys.stdout.write(ans + '\n')
		else:
			sys.stdout.write('YES' + '\n')
			sys.stdout.write(' '.join(map(str, ans)) + '\n')
main()


def odd(n, k):
	if n % 2 != k % 2 or k > n or (n - k) % 2 != 0:
		return None
	ans = [1] * k
	ans[0] += n - k
	return ans

def even(n, k):
	if n % 2 != 0 or 2 * k > n or (n - 2 * k) % 2 != 0:
		return None
	ans = [2] * k
	ans[0] += n - 2 * k
	return ans

def main():
	t = int(input())
	for _ in range(t):
		(n, k) = list(map(int, input().split()))
		l1 = odd(n, k)
		if not l1 is None:
			print('YES')
			for x in l1:
				print(x, end=' ')
			print()
		else:
			l2 = even(n, k)
			if not l2 is None:
				print('YES')
				for x in l2:
					print(x, end=' ')
				print()
			else:
				print('NO')
main()


I = input
t = int(I())
for _ in range(t):
	(n, k) = map(int, I().split())
	if n % 2 == 0:
		if k > n // 2:
			if k - 1 > n or (k - 1) % 2 == 0:
				print('NO')
				continue
			print('YES')
			print(n - (k - 1), *[1] * (k - 1))
			continue
		print('YES')
		print(n - 2 * (k - 1), *[2] * (k - 1))
	else:
		if k > n or k % 2 == 0:
			print('NO')
			continue
		print('YES')
		print(n - (k - 1), *[1] * (k - 1))


t = int(input())
while t:
	t -= 1
	(n, k) = map(int, input().strip().split(' '))
	if n >= k and (n & 1 and k & 1 or (not n & 1 and (not k & 1))):
		print('YES')
		print(*[1] * (k - 1), n - k + 1)
	elif n >= 2 * k and (not n & 1):
		print('YES')
		print(*[2] * (k - 1), n - 2 * (k - 1))
	else:
		print('NO')


from sys import stdin, stdout
t = int(stdin.readline())
import math
while t > 0:
	(n, k) = map(int, stdin.readline().split())
	if n < k:
		stdout.write('NO\n')
	elif n == k:
		stdout.write('YES\n')
		for i in range(k):
			stdout.write('1 ')
		stdout.write('\n')
	elif n % 2:
		if k % 2 == 0:
			stdout.write('NO\n')
		else:
			stdout.write('YES\n')
			for i in range(k - 1):
				stdout.write('1 ')
			stdout.write('{}\n'.format(n - k + 1))
	elif k % 2 == 0:
		stdout.write('YES\n')
		for i in range(k - 1):
			stdout.write('1 ')
		stdout.write('{}\n'.format(n - 1 * (k - 1)))
	elif k > n // 2:
		stdout.write('NO\n')
	else:
		stdout.write('YES\n')
		for i in range(k - 1):
			stdout.write('2 ')
		stdout.write('{}\n'.format(n - 2 * (k - 1)))
	t -= 1


def true(l):
	for i in l:
		print(i, end=' ')
x = int(input())
for i in range(x):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
	else:
		a = [1] * (k - 1)
		a.append(n - k + 1)
		b = [2] * (k - 1)
		b.append(n - 2 * (k - 1))
		m = all((i % 2 != 0 and i > 0 for i in a))
		n = all((i % 2 == 0 and i > 0 for i in b))
		if m == True or n == True:
			print('YES')
			if m == True:
				true(a)
			else:
				true(b)
		else:
			print('NO')


import copy

def check(a):
	f = copy.deepcopy(a)
	for i in range(len(f)):
		f[i] = f[i] % 2
	return min(f) == max(f)

def solve():
	(n, k) = map(int, input().split())
	s = [1 for _ in range(k - 1)] + [n - k + 1]
	d = [2 for __ in range(k - 1)] + [n - 2 * k + 2]
	if check(s) and n - k + 1 > 0:
		print('YES')
		print(*s)
	elif check(d) and n - 2 * k + 2 > 0:
		print('YES')
		print(*d)
	else:
		print('NO')

def test():
	for i in range(int(input())):
		solve()
test()


from bisect import bisect_left
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	if (n - (k - 1)) % 2 == 1 and n - (k - 1) > 0:
		print('YES')
		ans = [1] * (k - 1)
		ans.append(n - (k - 1))
		print(' '.join((str(x) for x in ans)))
	elif (n - 2 * (k - 1)) % 2 == 0 and n - 2 * (k - 1) > 0:
		print('YES')
		ans = [2] * (k - 1)
		ans.append(n - 2 * (k - 1))
		print(' '.join((str(x) for x in ans)))
	else:
		print('NO')


t = int(input(''))
for i in range(t):
	s = input('')
	L = s.split(' ')
	(n, k) = (int(L[0]), int(L[1]))
	if k > n:
		print('NO')
	elif n % 2 == 0:
		if k > n / 2 and k % 2 == 0:
			print('YES')
			L = []
			for j in range(k - 1):
				L.append(1)
			L.append(n - (k - 1))
			for p in L:
				print(p, end=' ')
			print('')
		elif k <= n / 2:
			print('YES')
			L = []
			for j in range(k - 1):
				L.append(2)
			L.append(n - 2 * (k - 1))
			for p in L:
				print(p, end=' ')
			print('')
		else:
			print('NO')
	elif k % 2 == 0:
		print('NO')
	else:
		print('YES')
		L = []
		for j in range(k - 1):
			L.append(1)
		L.append(n - (k - 1))
		for p in L:
			print(p, end=' ')
		print('')


t = int(input())
while t:
	(n, k) = map(int, input().split())
	ans = ''
	flag = True
	if n == k:
		ans += k * '1 '
	elif k > n:
		flag = False
	elif k == 1:
		ans = str(n)
	elif k == 2 and n % 2 == 1:
		flag = False
	elif n - k == 1:
		flag = False
	elif n % 2 == 0 and k % 2 == 0:
		ans += (k - 1) * '1 '
		ans += str(n - (k - 1))
	elif n % 2 == 0 and k % 2 == 1:
		if (k - 1) * 2 >= n:
			flag = False
		else:
			ans += (k - 1) * '2 '
			ans += str(n - (k - 1) * 2)
	elif n % 2 == 1 and k % 2 == 1:
		ans += (k - 1) * '1 '
		ans += str(n - (k - 1))
	elif n % 2 == 1 and k % 2 == 0:
		flag = False
	if flag:
		print('YES')
		print(ans)
	else:
		print('NO')
	t -= 1


def main():
	(n, k) = map(int, input().split())
	if n % 2 and (not k % 2):
		print('NO')
		return
	odd = False
	if n % 2 and k % 2:
		if n < k:
			print('NO')
			return
		print('YES')
		print('1 ' * (k - 1), end='')
		print(n - k + 1)
	if not n % 2 and k % 2:
		if n < 2 * k:
			print('NO')
			return
		print('YES')
		print('2 ' * (k - 1), end='')
		print(n - k * 2 + 2)
	if not n % 2 and (not k % 2):
		if n < k:
			print('NO')
			return
		print('YES')
		print('1 ' * (k - 1), end='')
		print(n - k + 1)
for _ in range(int(input())):
	main()


import math
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	ans = []
	flag = True
	if k > n:
		flag = False
	else:
		quotient = n // k
		remainder = n % k
		if remainder % 2 == 0:
			ans = [quotient] * k
			ans[0] += remainder
			flag = True
		elif k % 2 == 1:
			part1 = [quotient + remainder, quotient + k - 2]
			part2 = [quotient - 1] * (k - 2)
			part1.extend(part2)
			ans.extend(part1)
			if quotient - 1 <= 0:
				flag = False
			else:
				flag = True
		else:
			flag = False
	if flag:
		print('YES')
		print(*ans)
	else:
		print('NO')


test = int(input())
test_arr = []
for _ in range(test):
	(n, k) = map(int, input().split(' '))
	n_ = n % 2
	k_ = k % 2
	if n_ != 0 and k_ == 0:
		test_arr.append(('NO', []))
		continue
	d = k - 1
	d = k - 1
	if n_ == 0:
		if k_ == 0:
			s = n - int(d * 1)
			if s > 0:
				arr = [1] * d
				arr.append(s)
				test_arr.append(('YES', arr))
			else:
				test_arr.append(('NO', []))
		else:
			s = n - int(d * 2)
			if s > 0:
				arr = [2] * d
				arr.append(s)
				test_arr.append(('YES', arr))
			else:
				test_arr.append(('NO', []))
	else:
		s = n - int(d * 1)
		if s > 0:
			arr = [1] * d
			arr.append(n - int(d * 1))
			test_arr.append(('YES', arr))
		else:
			test_arr.append(('NO', []))
for t in test_arr:
	print(t[0])
	if len(t[1]) > 0:
		for i in t[1]:
			print(i, end=' ')
		print('')


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	if x % 2 == 0:
		if (x - (y - 1)) % 2 != 0 and x - (y - 1) > 0:
			print('YES')
			print('{}{}'.format('1 ' * (y - 1), x - (y - 1)))
		elif x - 2 * (y - 1) > 1:
			print('YES')
			print('{}{}'.format('2 ' * (y - 1), x - 2 * (y - 1)))
		else:
			print('NO')
	elif y % 2 == 0:
		print('NO')
	elif x - (y - 1) > 0:
		print('YES')
		print('{}{}'.format('1 ' * (y - 1), x - (y - 1)))
	else:
		print('NO')


for _ in range(int(input())):
	(sum1, n) = list(map(int, input().split()))
	even = sum1 - 2 * (n - 1)
	odd = sum1 - (n - 1)
	if even > 0 and even % 2 == 0:
		c = '2 ' * (n - 1)
		print('YES')
		print(c, end='')
		print(even)
	elif odd > 0 and odd % 2 == 1:
		c = '1 ' * (n - 1)
		print('YES')
		print(c, end='')
		print(odd)
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def main():
	try:
		for _ in range(inp()):
			(n, k) = invr()
			if n < k:
				print('NO')
			elif n == k:
				print('YES')
				print('1 ' * n)
			elif n - k + 1 > 0 and (n - k + 1) % 2 != 0:
				ans = n - k + 1
				print('YES')
				print('1 ' * (k - 1) + str(ans))
			elif n - 2 * (k - 1) > 0 and (n - 2 * (k - 1)) % 2 == 0:
				ans = n - 2 * (k - 1)
				print('YES')
				print('2 ' * (k - 1) + str(ans))
			else:
				print('No')
	except Exception as e:
		raise e
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for i in range(int(input())):
	(n, k) = map(int, input().split())
	l1 = []
	l2 = []
	(k1, k2) = (0, 0)
	for j in range(k - 1):
		k1 += 1
		l1.append(1)
	if (n - k1) % 2 != 0 and n >= k1:
		l1.append(n - k1)
		print('YES')
		print(*l1)
	else:
		for j in range(k - 1):
			k2 += 2
			l2.append(2)
		if (n - k2) % 2 == 0 and n >= k2 + 2:
			print('YES')
			l2.append(n - k2)
			print(*l2)
		else:
			print('NO')


t = int(input())
for tt in range(t):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
		continue
	if n % 2 == 0:
		if k % 2 == 1:
			l = [2 for i in range(k - 1)]
			lastvalue = n - sum(l)
			if lastvalue < 1:
				print('NO')
			else:
				l.append(lastvalue)
				print('YES')
				for ii in l:
					print(ii, end=' ')
				print('')
		else:
			l = [2 for i in range(k - 1)]
			lastvalue = n - sum(l)
			if lastvalue < 1:
				l = [1 for i in range(k - 1)]
				newlastvalue = n - sum(l)
				if newlastvalue <= 0:
					print('NO')
				else:
					l.append(newlastvalue)
					print('YES')
					for ii in l:
						print(ii, end=' ')
					print('')
			else:
				l.append(lastvalue)
				print('YES')
				for ii in l:
					print(ii, end=' ')
				print('')
	elif k % 2 == 1:
		print('YES')
		l = [1 for i in range(k - 1)]
		lastvalue = n - sum(l)
		l.append(lastvalue)
		for ii in l:
			print(ii, end=' ')
		print('')
	else:
		print('NO')


def solve_even(values):
	n = values[0]
	k = values[1]
	sum_value = 0
	list_v = [2] * (k - 1)
	rest = n - 2 * (k - 1)
	if rest % 2 == 0 and rest > 0:
		list_v.append(rest)
		string_ints = [str(int) for int in list_v]
		return ('YES', ' '.join(string_ints))
	else:
		return ('NO', None)

def solve_odd(values):
	n = values[0]
	k = values[1]
	sum_value = 0
	list_v = [1] * (k - 1)
	rest = n - (k - 1)
	if rest % 2 != 0 and rest > 0:
		list_v.append(rest)
		string_ints = [str(int) for int in list_v]
		return ('YES', ' '.join(string_ints))
	else:
		return ('NO', None)
times = int(input())
for i in range(times):
	values = input().split(' ')
	values = [int(i) for i in values]
	(res, arra) = solve_even(values)
	if res == 'YES':
		print(res)
		print(arra)
	else:
		(res, arra) = solve_odd(values)
		print(res)
		if res == 'YES':
			print(arra)


import math
import collections
from sys import stdin, stdout, setrecursionlimit
from bisect import bisect_left as bsl
from bisect import bisect_right as bsr
import heapq as hq
setrecursionlimit(2 ** 20)
t = 1
t = int(stdin.readline())
for _ in range(t):
	(n, k) = list(map(int, stdin.readline().rstrip().split()))
	if n % 2 == 1 and k % 2 == 0 or k > n:
		print('NO')
		continue
	elif n % 2 == k % 2:
		l = [1] * (k - 1)
		l.append(n - (k - 1))
		print('YES')
		print(*l)
	else:
		l = [2] * (k - 1)
		if 2 * k > n:
			print('NO')
			continue
		else:
			l.append(n - (2 * k - 2))
			print('YES')
			print(*l)


n = int(input())
for lmao in range(n):
	(n, k) = map(int, input().split())
	if k == 1:
		print('YES\n{}'.format(n))
	elif k > n:
		print('NO')
	elif (n - k + 1) % 2 == 1:
		print('YES')
		for suh in range(k):
			if suh == 0:
				print(n - k + 1, end=' ')
			else:
				print(1, end=' ')
		print()
	elif n - 2 * k >= 0 and (n - 2 * k + 2) % 2 == 0:
		print('YES')
		for suh in range(k):
			if suh == 0:
				print(n - 2 * k + 2, end=' ')
			else:
				print(2, end=' ')
		print()
	else:
		print('NO')


from sys import stdin, gettrace
if not gettrace():

	def input():
		return next(stdin)[:-1]

def main():

	def solve():
		(n, k) = map(int, input().split())
		if n % 2 == 1 and k % 2 == 0:
			print('NO')
			return
		if n % 2 == 0 and k % 2 == 1 and (n < k * 2):
			print('NO')
			return
		if n < k:
			print('NO')
			return
		if n % 2 == 0 and k % 2 == 1:
			base = 2
		else:
			base = 1
		res = [base] * (k - 1) + [n - base * (k - 1)]
		print('YES')
		print(' '.join(map(str, res)))
	q = int(input())
	for _ in range(q):
		solve()
main()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = []
	l1 = []
	(f1, f2) = (0, 0)
	(a, b) = (k - 1, k - 1)
	(s1, s2) = (0, 0)
	while a > 0:
		l.append(2)
		s1 += 2
		a -= 1
	if (n - s1) % 2 == 0 and n - s1 > 0:
		l.append(n - s1)
		f1 = 1
	while b > 0:
		l1.append(1)
		s2 += 1
		b -= 1
	if (n - s2) % 2 != 0 and n - s2 > 0:
		l1.append(n - s2)
		f2 = 1
	if f1 == 1:
		print('YES')
		print(*l)
	elif f2 == 1:
		print('YES')
		print(*l1)
	else:
		print('NO')


res = []
t = int(input())
for i in range(t):
	(n, k) = [x for x in input().split()]
	res.append((int(n), int(k)))
for (n, k) in res:
	if n % 2 == 0 and divmod(n, 2)[0] - k >= 0:
		print('YES')
		print('2 ' * (k - 1), end='')
		print(n - 2 * (k - 1))
	elif n >= k and (n - k) % 2 == 0:
		print('YES')
		val = 2 * divmod(n - k, 2)[0] + 1
		print('1 ' * (k - 1), end='')
		print(val)
	else:
		print('NO')


for mda in range(int(input())):
	(n, k) = map(int, input().split())
	if n % k == 0:
		print('YES')
		for i in range(k):
			print(n // k, end=' ')
		print()
	else:
		d1 = n - (k - 1)
		d2 = n - 2 * (k - 1)
		if d1 > 0 and d1 % 2 != 0:
			print('YES')
			for i in range(k - 1):
				print(1, end=' ')
			print(d1)
		elif d2 > 0 and d2 % 2 == 0:
			print('YES')
			for i in range(k - 1):
				print(2, end=' ')
			print(d2)
		else:
			print('NO')


t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	arr = []
	good = True
	if n % 2 == 1 and k % 2 == 0:
		good = False
	if n % 2 == 0 and k % 2 == 1:
		if n < 2 * k:
			good = False
		else:
			arr = [2] * (k - 1)
			arr.append(n - 2 * (k - 1))
			if n - 2 * (k - 1) <= 0:
				good = False
	else:
		arr = [1] * (k - 1)
		arr.append(n - k + 1)
		if n - k + 1 <= 0:
			good = False
	if good:
		print('YES')
		print(' '.join(map(str, arr)))
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
		continue
	if n % 2 == 0:
		if k % 2 == 0:
			print('YES')
			for j in range(k - 1):
				print(1, end=' ')
			print(n - k + 1)
		elif k * 2 > n:
			print('NO')
		else:
			print('YES')
			for j in range(k - 1):
				print(2, end=' ')
			print(n - (k - 1) * 2)
	elif k % 2 == 0:
		print('NO')
	else:
		print('YES')
		for j in range(k - 1):
			print(1, end=' ')
		print(n - k + 1)


from sys import stdin, stdout

def main():
	t = int(stdin.readline())
	for _ in range(t):
		(n, k) = list(map(int, stdin.readline().split()))
		if n - (k - 1) > 0 and (n - (k - 1)) % 2 == 1:
			stdout.write('YES\n')
			for _ in range(k - 1):
				stdout.write('1 ')
			stdout.write(str(n - (k - 1)) + '\n')
			continue
		elif n - (k - 1) * 2 > 0 and (n - (k - 1) * 2) % 2 == 0:
			stdout.write('YES\n')
			for _ in range(k - 1):
				stdout.write('2 ')
			stdout.write(str(n - (k - 1) * 2) + '\n')
			continue
		else:
			stdout.write('NO\n')
main()


def createSumm(n, k):
	if n < k:
		return 0
	elif n % 2 == 1 and k == 1:
		l = []
		l.append(n)
		return l
	else:
		l = []
		c = k - 1
		if (n - 2 * c) % 2 == 0 and n - 2 * c > 0:
			for i in range(c):
				l.append(2)
			l.append(n - 2 * c)
			return l
		if (n - c) % 2 != 0 and n - c > 0:
			for i in range(c):
				l.append(1)
			l.append(n - c)
			return l
		else:
			return 0

def outputRes(a_list):
	for i in a_list:
		if i == 0:
			print('NO')
		else:
			print('YES')
			for j in i:
				print(j, end=' ')
			print(end='\n')

def inputVal():
	t = int(input(''))
	a_list = []
	for i in range(t):
		vals = input('').split(' ')
		n = int(vals[0])
		k = int(vals[1])
		a_list.append(createSumm(n, k))
	outputRes(a_list)
inputVal()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	n1 = n - (k - 1)
	if n1 > 0 and n1 % 2 != 0:
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(n1)
		continue
	n2 = n - 2 * (k - 1)
	if n2 > 0 and n2 % 2 == 0:
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		print(n2)
		continue
	print('NO')


from sys import stdin
inp = stdin.readline
t = int(inp().strip())
while t:
	t -= 1
	(n, k) = [int(k) for k in inp().strip().split()]
	if (n - k + 1) % 2 == 1 and n - k + 1 > 0:
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(n - k + 1)
	elif (n - 2 * (k - 1)) % 2 == 0 and n - 2 * (k - 1) > 0:
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		print(n - 2 * (k - 1))
	else:
		print('NO')


t = int(input())
while t:
	t -= 1
	(n, k) = input().split()
	n = int(n)
	k = int(k)
	if k > n:
		print('No')
	elif k == n:
		print('Yes')
		for i in range(n):
			print('1', end=' ')
		print()
	elif not n % 2:
		if k <= n / 2:
			print('Yes')
			for i in range(k - 1):
				print('2', end=' ')
			print(n - 2 * (k - 1))
		elif not k % 2:
			print('Yes')
			for i in range(k - 1):
				print(1, end=' ')
			print(n - (k - 1))
		else:
			print('No')
	elif not k % 2:
		print('No')
	else:
		print('Yes')
		for i in range(k - 1):
			print('1', end=' ')
		print(n - (k - 1))


def is_odd(n):
	if n > 0 and n % 2 == 1:
		return True
	return False

def is_even(n):
	if n > 0 and n % 2 == 0:
		return True
	return False

def odd_parity(n, k):
	if k > n:
		return False
	if (n - k) % 2 == 0:
		return True
	else:
		return False

def even_parity(n, k):
	if 2 * k > n:
		return False
	if (n - 2 * k) % 2 == 0:
		return True
	else:
		return False

def solve(n, k):
	if odd_parity(n, k):
		print('YES')
		stri = ''
		for i in range(k - 1):
			stri += '1 '
		num = n + 1 - k
		stri = stri + str(num)
		print(stri)
	elif even_parity(n, k):
		print('YES')
		stri = ''
		for i in range(k - 1):
			stri += '2 '
		num = n + 2 - 2 * k
		stri = stri + str(num)
		print(stri)
	else:
		print('NO')
for i in range(int(input())):
	inp = input().split()
	solve(int(inp[0]), int(inp[1]))


t = int(input())
for i in range(t):
	s = str(input())
	qq = 0
	for i in range(len(s)):
		if s[i] == ' ':
			qq = i
	n = int(s[0:qq])
	k = int(s[qq:len(s)])
	s = ''
	if n - (k - 1) > 0 and (n - k + 1) % 2 == 1:
		for i in range(k - 1):
			s += '1 '
		s += str(n - k + 1)
		print('YES')
		print(s)
		continue
	elif n - 2 * (k - 1) > 0 and (n - 2 * (k - 1)) % 2 == 0:
		s == ''
		for i in range(k - 1):
			s += '2 '
		s += str(n - 2 * (k - 1))
		print('YES')
		print(s)
		continue
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	if n < k:
		print('NO')
		continue
	if k % 2 == 0 and n % 2 == 1:
		print('NO')
		continue
	if n % 2 == 0 and k % 2 == 1 and (n < 2 * k):
		print('NO')
		continue
	if n % 2 == 1 and k % 2 == 1:
		print('YES')
		a = []
		for i in range(k - 1):
			a.append(1)
		a.append(n - k + 1)
		a = list(map(str, a))
		print(' '.join(a))
		continue
	if n % 2 == 0 and k % 2 == 1:
		print('YES')
		a = []
		for i in range(k - 1):
			a.append(2)
		a.append(n - 2 * k + 2)
		a = list(map(str, a))
		print(' '.join(a))
		continue
	print('YES')
	a = []
	for i in range(k - 1):
		a.append(1)
	a.append(n - k + 1)
	a = list(map(str, a))
	print(' '.join(a))


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
		continue
	if n % 2 == 1:
		if k % 2 == 0:
			print('NO')
		else:
			print('YES')
			ans = ['1' for i in range(k - 1)] + [str(n - k + 1)]
			print(' '.join(ans))
	elif k % 2 == 0:
		print('YES')
		ans = ['1' for i in range(k - 1)] + [str(n - (k - 1))]
		print(' '.join(ans))
	elif k * 2 <= n:
		print('YES')
		ans = ['2' for i in range(k - 1)] + [str(n - (k - 1) * 2)]
		print(' '.join(ans))
	else:
		print('NO')


t = int(input())
res = []
for i in range(t):
	inp = input().split()
	n = int(inp[0])
	k = int(inp[1])
	if (n - k + 1) % 2 and n - k + 1 > 0:
		l = [1] * (k - 1)
		l.append(n - k + 1)
		res.append(['YES', l])
	elif (n - 2 * (k - 1)) % 2 == 0 and n - 2 * (k - 1) > 0:
		l = [2] * (k - 1)
		l.append(n - 2 * (k - 1))
		res.append(['YES', l])
	else:
		res.append(['NO'])
for i in res:
	if len(i) == 2:
		print(i[0])
		print(' '.join(map(str, i[1])))
	else:
		print(i[0])


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n & 1 == k & 1 and n >= k:
		print(f"YES\n{n - k + 1}{' 1' * (k - 1)}")
	elif not n & 1 and k & 1 and (n >= k * 2):
		print(f"YES\n{n - k * 2 + 2}{' 2' * (k - 1)}")
	else:
		print('NO')


def solve(num, k):
	b = 2 if num % 2 == 0 and k % 2 == 1 else 1
	l = [b] * (k - 1)
	r = num - sum(l)
	if r > 0 and r % 2 == b % 2:
		print('YES')
		print(*l, r)
	else:
		print('NO')
	return

def main():
	t = int(input())
	while t > 0:
		[n, k] = list(map(int, input().split()))
		solve(n, k)
		t -= 1
main()


(t,) = map(int, input().split())
for _ in range(t):
	(n, k) = map(int, input().split())
	if n % 2:
		if k % 2:
			if n < k:
				print('NO')
			else:
				print('YES')
				print(*[1] * (k - 1) + [n - (k - 1)])
		else:
			print('NO')
	elif k % 2:
		if 2 * k > n:
			print('NO')
		else:
			print('YES')
			print(*[2] * (k - 1) + [n - 2 * (k - 1)])
	elif n < k:
		print('NO')
	else:
		print('YES')
		print(*[1] * (k - 1) + [n - (k - 1)])


for i in range(int(input())):
	(n, k) = map(int, input().split())
	l = []
	p = 0
	if k > n or (n % 2 != 0 and k % 2 == 0):
		print('NO')
	else:
		if n == k:
			for j in range(k):
				l.append(1)
		elif k % 2 != 0 and n % 2 != 0:
			for j in range(k):
				if j == 0:
					l.append(n + 1 - k)
				else:
					l.append(1)
		elif n % 2 == 0 and k % 2 == 0:
			a = n + 2 - 2 * k
			b = n + 1 - k
			if a > 0:
				for j in range(k):
					if j == 0:
						l.append(n + 2 - 2 * k)
					else:
						l.append(2)
			elif b > 0:
				for j in range(k):
					if j == 0:
						l.append(n + 1 - k)
					else:
						l.append(1)
		else:
			for j in range(k):
				if j == 0:
					l.append(n + 2 - 2 * k)
				else:
					l.append(2)
		for j in l:
			if j <= 0:
				p += 1
		if p >= 1:
			print('NO')
		else:
			print('YES')
			print(*l)


import sys
input = sys.stdin.readline
from math import log2, log, ceil

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return res

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
for _ in range(int(input())):
	(n, k) = int_array()
	ans = []
	if n - k + 1 > 0 and (n - k + 1) % 2 != 0:
		for ___ in range(k - 1):
			ans.append(1)
		ans.append(n - k + 1)
		print('YES')
		print(*ans)
		continue
	if n - 2 * (k - 1) > 0 and (n - 2 * (k - 1)) % 2 == 0:
		ans = []
		for ___ in range(k - 1):
			ans.append(2)
		ans.append(n - 2 * (k - 1))
		print('YES')
		print(*ans)
		continue
	print('NO')


import math
from sys import stdin, stdout
from heapq import heapify, heappop, heappush
from collections import Counter
T = int(stdin.readline())
for i in range(T):
	(n, k) = list(map(int, stdin.readline().split()))
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
		continue
	if n % 2 == 0 and k % 2:
		if 2 * k > n:
			print('NO')
			continue
		print('YES')
		new = n
		while k - 1:
			print(2, end=' ')
			n -= 2
			k -= 1
		print(n, end=' ')
		print()
		continue
	if n % 2 and k % 2:
		if k > n:
			print('NO')
			continue
		print('YES')
		new = n
		while k - 1:
			print(1, end=' ')
			n -= 1
			k -= 1
		print(n, end=' ')
		print()
		continue
	if k > n:
		print('NO')
		continue
	print('YES')
	while k - 1:
		print(1, end=' ')
		n -= 1
		k -= 1
	print(n, end=' ')
	print()


for t in range(int(input())):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
		continue
	if n % 2 == 0:
		if k > n // 2:
			if k % 2 == 0:
				print('YES')
				print('1 ' * (k - 1) + str(n - (k - 1)))
			else:
				print('NO')
		else:
			print('YES')
			print('2 ' * (k - 1) + str(n - 2 * (k - 1)))
	elif k % 2 == 0:
		print('NO')
	else:
		print('YES')
		print('1 ' * (k - 1) + str(n - (k - 1)))


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		(N, K) = [int(x) for x in input().split()]
		if N % 2 == 1 and K % 2 == 0:
			print('NO')
			continue
		if N % 2 == 0 and (2 * K > N and N - K == 1):
			print('NO')
			continue
		if N % 2 == 0:
			if K % 2 == 0:
				ans = []
				for i in range(K - 1):
					ans.append(1)
				x = N - sum(ans)
				if x <= 0 or x % 2 == 0:
					print('NO')
					continue
				ans.append(x)
				print('YES')
				print(*ans)
			else:
				ans = []
				for i in range(K - 1):
					ans.append(2)
				x = N - sum(ans)
				if x <= 0 or x % 2 == 1:
					print('NO')
					continue
				ans.append(x)
				print('YES')
				print(*ans)
		else:
			ans = []
			for i in range(K - 1):
				ans.append(1)
			x = N - sum(ans)
			if x <= 0:
				print('NO')
				continue
			ans.append(x)
			print('YES')
			print(*ans)
main()


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def main():
	for tin in range(int(input())):
		(n, k) = map(int, input().split())
		if k > n:
			print('NO')
		elif n % 2 == 1 and k % 2 == 0:
			print('NO')
		elif n % 2 == 0 and k % 2 == 1 and (k > n // 2):
			print('NO')
		elif n % 2 == k % 2:
			print('YES')
			print('1 ' * (k - 1) + str(n - k + 1))
		else:
			print('YES')
			print('2 ' * (k - 1) + str(n - (k - 1) * 2))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
for i in range(t):
	arr = []
	a = list(map(int, input().split()))
	if a[0] % 2 != 0 and a[1] % 2 == 0:
		print('NO', end=' ')
	elif a[0] < a[1]:
		print('NO', end=' ')
	elif a[0] % 2 == 0 and a[1] % 2 != 0:
		if a[0] // a[1] >= 2:
			print('YES')
			for j in range(a[1] - 1):
				print('2', end=' ')
			print(a[0] - 2 * (a[1] - 1), end=' ')
		else:
			print('NO', end=' ')
	elif a[0] % 2 == 0 and a[1] % 2 == 0:
		print('YES')
		for j in range(a[1] - 1):
			print('1', end=' ')
		print(a[0] - a[1] + 1, end=' ')
	elif a[0] % 2 != 0 and a[1] % 2 != 0:
		print('YES')
		for j in range(a[1] - 1):
			print('1', end=' ')
		print(a[0] - a[1] + 1, end=' ')
	print(end='\n')


cc = int(input())

def fun(z):
	for i in z:
		print(i, end=' ')
for jk in range(cc):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
	else:
		a = [1] * (k - 1)
		a.append(n - k + 1)
		b = [2] * (k - 1)
		b.append(n - 2 * (k - 1))
		m = all((jk % 2 != 0 and jk > 0 for jk in a))
		n = all((jk % 2 == 0 and jk > 0 for jk in b))
		if m == True or n == True:
			print('YES')
			if m == True:
				fun(a)
			else:
				fun(b)
		else:
			print('NO')


from sys import stdin, stdout
from math import *
for __ in range(int(input())):
	(n, m) = map(int, input().split())
	a1 = []
	a2 = []
	for i in range(m - 1):
		a1.append(1)
		a2.append(2)
	if n - (m - 1) > 0 and (n - (m - 1)) % 2 == 1:
		a1.append(n - (m - 1))
	elif n - 2 * (m - 1) > 0 and (n - 2 * (m - 1)) % 2 == 0:
		a2.append(n - 2 * (m - 1))
	if len(a1) == m:
		print('YES')
		print(*a1)
		continue
	elif len(a2) == m:
		print('YES')
		print(*a2)
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	odd = n - k + 1
	even = n - (k - 1) * 2
	if odd > 0 and odd % 2 == 1:
		print('YES')
		print('1 ' * (k - 1), odd, sep='')
	elif even > 0 and even % 2 == 0:
		print('YES')
		print('2 ' * (k - 1), even, sep='')
	else:
		print('NO')


for i in range(int(input())):
	(n, k) = map(int, input().split())
	ans = []
	f = 10
	if k > n:
		f = 0
	elif k == n:
		f = 1
		for i in range(k):
			ans.append(1)
	elif n % 2 != 0 and k % 2 != 0 and (n - k + 1 > 0):
		f = 1
		for i in range(k - 1):
			ans.append(1)
		ans.append(n - k + 1)
	elif n % 2 == 0:
		if k > n // 2 and k % 2 == 0:
			f = 1
			for i in range(k - 1):
				ans.append(1)
			ans.append(n - k + 1)
		elif k <= n // 2:
			f = 1
			for i in range(k - 1):
				ans.append(2)
			ans.append(n - 2 * (k - 1))
		else:
			f = 0
	else:
		f = 0
	if f == 1:
		print('YES')
		for i in ans:
			print(i, end=' ')
		print()
	else:
		print('NO')


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [Scanner.string() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [Scanner.int() for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def divisor(n):
		res = []
		i = 1
		for i in range(1, int(n ** 0.5) + 1):
			if n % i == 0:
				res.append(i)
				if i != n // i:
					res.append(n // i)
		return res

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

def pop_count(x):
	x = x - (x >> 1 & 6148914691236517205)
	x = (x & 3689348814741910323) + (x >> 2 & 3689348814741910323)
	x = x + (x >> 4) & 1085102592571150095
	x = x + (x >> 8)
	x = x + (x >> 16)
	x = x + (x >> 32)
	return x & 127
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def solve():
	(N, K) = Scanner.map_int()
	X = N - (K - 1)
	if X > 0 and X % 2 == 1:
		print('YES')
		print(*['1' for _ in range(K - 1)], X, sep=' ')
		return
	X = N - 2 * (K - 1)
	if X > 0 and X % 2 == 0:
		print('YES')
		print(*['2' for _ in range(K - 1)], X, sep=' ')
		return
	print('NO')

def main():
	T = Scanner.int()
	for _ in range(T):
		solve()
main()


t = int(input())
for _ in range(t):
	(n, k) = [int(i) for i in input().split()]
	if (n - (k - 1)) % 2 == 1 and n - (k - 1) > 0:
		print('YES')
		print('1 ' * (k - 1) + str(n - (k - 1)))
		continue
	if (n - 2 * (k - 1)) % 2 == 0 and n - 2 * (k - 1) > 0:
		print('YES')
		print('2 ' * (k - 1) + str(n - 2 * (k - 1)))
		continue
	print('NO')


def find_terms(n, k):
	if k == 1:
		return '\n'.join(['YES', str(n)])
	if k > n or (n % 2 != 0 and k % 2 == 0):
		return 'NO'
	if k == n:
		return '\n'.join(['YES', ' '.join([str(1)] * n)])
	if n % 2 == 0 and k % 2 == 0 or (n % 2 != 0 and k % 2 != 0):
		res = [str(1)] * (k - 1) + [str(n - k + 1)]
		return '\n'.join(['YES', ' '.join(res)])
	if n % 2 == 0 and k * 2 <= n:
		res = [str(2)] * (k - 1) + [str(n - 2 * (k - 1))]
		return '\n'.join(['YES', ' '.join(res)])
	return 'NO'
pairs = []
for _ in range(int(input())):
	pairs.append([int(s) for s in input().split()])
results = [find_terms(n, k) for (n, k) in pairs]
print('\n'.join(results), sep='')


for t in range(int(input())):
	(n, k) = map(int, input().split())
	if n < k:
		print('NO')
		continue
	r = True
	y = 1 + (n - k)
	if y > 0 and y % 2 == 1:
		print('YES')
		ans = [1] * (k - 1) + [y]
		print(*ans)
		r = False
	if r:
		y = n - 2 * (k - 1)
		if y > 0 and y % 2 == 0:
			print('YES')
			ans = [2] * (k - 1) + [y]
			print(*ans)
			r = False
	if r:
		print('NO')


from sys import stdin, stdout, setrecursionlimit
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if k > n or (n % 2 == 1 and k % 2 == 0) or (k % 2 == 1 and n % 2 == 0 and (k * 2 > n)):
		print('NO')
	else:
		a = []
		if n % 2 == k % 2:
			for i in range(k - 1):
				a.append(1)
				n -= 1
			a.append(n)
		elif n % 2 == 0:
			for i in range(k - 1):
				a.append(2)
				n -= 2
			a.append(n)
		print('YES')
		print(*a)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	f = 0
	if k > n:
		print('NO')
	elif n == k:
		print('YES')
		f = 1
		l = [1] * k
	elif n % 2 == 1:
		if k % 2 == 0:
			print('NO')
		else:
			f = 1
			print('YES')
			l = [1] * (k - 1)
			l += [n - k + 1]
	elif k > n / 2:
		if k % 2 == 1:
			print('NO')
		else:
			print('YES')
			f = 1
			l = [1] * (k - 1)
			l += [n - k + 1]
	else:
		print('YES')
		f = 1
		l = [2] * (k - 1)
		l += [n - 2 * k + 2]
	if f == 1:
		for i in l:
			print(i, end=' ')
		print()


t = int(input())
while t:
	(n, k) = map(int, input().split())
	ans = []
	if n % k == 0:
		ap = n // k
		for i in range(k):
			ans.append(ap)
		print('YES')
		print(*ans)
	else:
		temp = n % k
		temp1 = n // k
		ans = []
		for i in range(k):
			ans.append(temp1)
		mainn = n
		n = len(ans)
		if k > mainn:
			print('NO')
		elif temp % 2 == 0:
			ans[-1] += temp
			print('YES')
			print(*ans)
		else:
			for i in range(n - 1, n - 1 - temp, -1):
				ans[i] += 1
			if (n - temp) % 2 != 0:
				print('NO')
			else:
				f = 0
				n = len(ans)
				for i in range(n - temp):
					if i % 2 == 0:
						ans[i] -= 1
						if ans[i] == 0:
							print('NO')
							f = 1
							break
					else:
						ans[i] += 1
				if f != 1:
					print('YES')
					print(*ans)
	t -= 1


import math, sys
import heapq
from fractions import Fraction
from collections import Counter, defaultdict

def li():
	return list(map(int, sys.stdin.readline().split()))

def ls():
	return list(map(int, list(input())))

def la():
	return list(input())

def ii():
	return int(input())

def dic(x):
	return defaultdict(lambda : x)

def isPrime(n):
	i = 2
	if n == 1:
		return False
	while i <= int(math.sqrt(n)):
		if n % i == 0:
			return False
		i = i + 1
	return True

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def LCM(a, b):
	return a * b / gcd(a, b)
t = int(input())
for _ in range(t):
	(n, k) = li()
	if (n - (k - 1) * 2) % 2 == 0 and n - (k - 1) * 2 > 0:
		print('YES')
		a = '2 ' * (k - 1) + str(n - (k - 1) * 2)
		print(a)
	elif (n - (k - 1)) % 2 != 0 and n - (k - 1) > 0:
		print('YES')
		a = '1 ' * (k - 1) + str(n - (k - 1))
		print(a)
	else:
		print('NO')


t = int(input())
final_list = []
for _ in range(t):
	line = input()
	final_list.append(tuple(line.split()))
for tup in final_list:
	x = int(tup[0])
	y = int(tup[1])
	if x < y:
		print('NO')
	elif x % 2 == 1 and y % 2 == 0:
		print('NO')
	elif x % 2 == y % 2:
		print('YES')
		(print('1 ' * (y - 1), end=''), print(x - y + 1))
	elif x % 2 == 0 and y % 2 == 1:
		if x / 2 >= y:
			print('YES')
			(print('2 ' * (y - 1), end=''), print(x - 2 * (y - 1)))
		else:
			print('NO')


t = int(input())
while t > 0:
	t -= 1
	(n, k) = map(int, input().split())
	ch = n - 2 * (k - 1)
	nch = n - 1 * (k - 1)
	ok = 0
	ans = []
	if ch > 0 and ch % 2 == 0:
		for i in range(0, k - 1):
			ans.append(2)
		ans.append(ch)
		ok = 1
	if ok != 1 and nch > 0 and (nch % 2 == 1):
		for i in range(0, k - 1):
			ans.append(1)
		ans.append(nch)
		ok = 1
	if ok == 1:
		print('YES')
		for x in ans:
			print(x, end=' ')
		print('')
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	(n, k) = map(int, input().split())
	if n % 2 == 1 and k % 2 == 0:
		print('No')
	elif n % 2 == 1 and k % 2 == 1:
		if n < k:
			print('No')
		else:
			lista = []
			print('YES')
			for i in range(0, k - 1):
				print(1, end=' ')
			print(n - k + 1)
	elif n % 2 == 0 and k % 2 == 0:
		if n < k:
			print('No')
		else:
			lista = []
			print('YES')
			for i in range(0, k - 1):
				print(1, end=' ')
			print(n - k + 1)
	elif n < 2 * k:
		print('No')
	else:
		print('YES')
		lista = []
		for i in range(0, k - 1):
			print(2, end=' ')
		print(n - 2 * k + 2)


import sys
I = sys.stdin.readline
for _ in range(int(I())):
	(n, k) = map(int, I().split())
	if 1 * (k - 1) + n - (k - 1) == n and n - k + 1 > 0 and ((n - k + 1) % 2 != 0):
		print('YES')
		ans = [1] * (k - 1) + [n - k + 1]
		print(*ans)
	elif 2 * (k - 1) + n - 2 * (k - 1) == n and n - 2 * k + 2 > 0 and ((n - 2 * k + 2) % 2 == 0):
		print('YES')
		ans = [2] * (k - 1) + [n - 2 * k + 2]
		print(*ans)
	else:
		print('NO')


t = int(input())
b = []
for i in range(t):
	x = list(map(int, input().split()))
	a = []
	n = x[0]
	k = x[1]
	if k > n:
		r = 'NO'
		b.append(r)
	elif k % 2 == 0 and n % 2 != 0:
		r = 'NO'
		b.append(r)
	elif k % 2 == n % 2:
		r = 'YES'
		b.append(r)
		for j in range(k - 1):
			a.append(1)
		a.append(n - k + 1)
		res = ' '.join(map(str, a))
		b.append(res)
	elif k > n / 2:
		r = 'NO'
		b.append(r)
	else:
		r = 'YES'
		b.append(r)
		for j in range(k - 1):
			a.append(2)
		a.append(n - 2 * k + 2)
		res = ' '.join(map(str, a))
		b.append(res)
for i in range(len(b)):
	print(b[i])


for _ in range(int(input())):
	strr = input()
	(n, k) = [int(x) for x in strr.split()]
	if n < k:
		print('NO')
		continue
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
		continue
	if (n - (k - 1)) % 2 == 1:
		res = [1] * (k - 1) + [n - (k - 1)]
	elif n - 2 * (k - 1) > 0:
		res = [2] * (k - 1) + [n - 2 * (k - 1)]
	else:
		print('NO')
		continue
	res = [str(i) for i in res]
	print('YES')
	print(' '.join(res))


T = int(input())
for t in range(T):
	(n, k) = map(int, input().split())
	(sum1, sum2) = (0, 0)
	if n % 2 != 0 and k % 2 == 0:
		print('NO')
		continue
	else:
		for i in range(k - 1):
			sum1 = sum1 + 1
			sum2 = sum2 + 2
		if n % 2 == k % 2:
			if sum1 >= n:
				print('NO')
				continue
			else:
				print('YES')
				for i in range(k - 1):
					print('1', end=' ')
				print(n - sum1)
		elif n % 2 == 0 and k % 2 != 0:
			if sum2 >= n:
				print('NO')
				continue
			else:
				print('YES')
				for i in range(k - 1):
					print('2', end=' ')
				print(n - sum2)


t = int(input())
while t != 0:
	t -= 1
	(n, k) = map(int, input().split())
	lt = []
	if n % k == 0:
		lt = [n // k for _ in range(k)]
		print('YES')
		print(*lt)
	elif n < k:
		print('NO')
	else:
		lt = [n // k for _ in range(k)]
		p = n % k
		lt[0] += p
		if (lt[0] + lt[1]) % 2 == 0:
			print('YES')
			print(*lt)
		else:
			if (k - 1) % 2 != 0:
				print('NO')
				continue
			for i in range(1, k - 1, 2):
				lt[i] = lt[i] - 1
				lt[i + 1] = lt[i + 1] + 1
			if 0 in lt:
				print('NO')
			else:
				print('YES')
				print(*lt)


from typing import Tuple, Optional, List

def solve(n: int, k: int) -> Tuple[bool, Optional[List[int]]]:
	if n < k:
		return (False, None)
	if n % 2 == 1:
		if k % 2 == 0:
			return (False, None)
		return (True, [1] * (k - 1) + [n - k + 1])
	if k % 2 == 0:
		return (True, [1] * (k - 1) + [n - k + 1])
	if n < 2 * k:
		return (False, None)
	return (True, [2] * (k - 1) + [n - 2 * k + 2])
for _ in range(int(input())):
	(solved, summands) = solve(*map(int, input().split()))
	if solved:
		print('YES')
		assert summands is not None
		print(' '.join(map(str, summands)))
	else:
		print('NO')


tes = int(input())
for i in range(tes):
	a = input().split()
	(n, k) = (int(a[0]), int(a[1]))
	flag = False
	if k == 1:
		print('YES')
		print(n)
		flag = True
	else:
		nums = 1 * (k - 1)
		if n - nums > 0 and (n - nums) % 2 == 1:
			a = [1] * (k - 1)
			a.append(n - nums)
			print('YES')
			print(*a)
			flag = True
		if not flag:
			nums = 2 * (k - 1)
			if n - nums > 0 and (n - nums) % 2 == 0:
				a = [2] * (k - 1)
				a.append(n - nums)
				print('YES')
				print(*a)
				flag = True
	if not flag:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if k > n:
		print('no')
	elif n % 2 == k % 2:
		print('yes')
		a = []
		a.append(n - k + 1)
		for i in range(k - 1):
			a.append(1)
		print(*a)
	elif n % 2 == 0 and k % 2 == 1:
		if 2 * k > n:
			print('no')
		else:
			print('yes')
			a = []
			a.append(n - 2 * (k - 1))
			for ii in range(k - 1):
				a.append(2)
			print(*a)
	else:
		print('no')


for i in range(int(input())):
	(n, k) = [int(i) for i in input().split()]
	if n >= k:
		if k == 1:
			print('Yes')
			print(n)
		elif k == n:
			print('Yes')
			print(' '.join(['1' for i in range(k)]))
		elif (n - k + 1) % 2:
			print('Yes')
			print(' '.join(['1' for i in range(k - 1)]), n - k + 1)
		elif (n - 2 * k + 2) % 2 == 0 and n - 2 * k + 2 > 1:
			print('yes')
			print(' '.join(['2' for i in range(k - 1)]), n - 2 * k + 2)
		else:
			print('No')
	else:
		print('No')


t = int(input())
ls = []
ls2 = []
for k in range(t):
	(n, k) = map(int, input().split())
	ls.append(n)
	ls2.append(k)
for i in range(t):
	a = ls[i]
	b = ls2[i]
	if a % b == 0:
		print('YES')
		for j in range(b):
			print(int(a / b), end=' ')
		print(' ')
	else:
		div = int(a / b)
		n1 = div
		n2 = a - n1 * (b - 1)
		if n1 % 2 == n2 % 2 and n1 > 0 and (n2 > 0):
			print('YES')
			for j in range(b - 1):
				print(n1, end=' ')
			print(n2)
		elif n2 - (b - 1) > 0 and (n1 + 1) % 2 == (n2 - (b - 1)) % 2 and (n1 + 1 > 0) and (n2 - (b - 1) > 0):
			print('YES')
			for j in range(b - 1):
				print(n1 + 1, end=' ')
			print(n2 - (b - 1))
		elif n1 > 1 and (n2 + b - 1) % 2 == (n1 - 1) % 2 and (n2 + b - 1 > 0):
			print('YES')
			for j in range(b - 1):
				print(n1 - 1, end=' ')
			print(n2 + (b - 1))
		else:
			print('NO')


t = int(input())
for w in range(t):
	(n, k) = (int(i) for i in input().split())
	if n < k:
		print('NO')
	elif n == k:
		print('YES')
		print(*[1] * k)
	elif n % k == 0:
		print('YES')
		print(*[n // k] * k)
	elif (n - k) % 2 == 0:
		print('YES')
		l = [1] * (k - 1)
		l.append(n - k + 1)
		print(*l)
	elif (n - 2 * k) % 2 == 0 and n - 2 * k > 0:
		print('YES')
		l = [2] * (k - 1)
		l.append(n - 2 * (k - 1))
		print(*l)
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, k) = [int(i) for i in input().split()]
	min_val = 0
	if k > n:
		print('NO')
		continue
	if n % 2 != 0:
		min_val = 1
		if k % 2 == 0:
			print('NO')
			continue
		if k > n:
			print('NO')
			continue
		print('YES')
		remaining = n - (k - 1)
		print('1 ' * (k - 1) + str(remaining))
	else:
		if k == n:
			print('YES')
			print('1 ' * k)
			continue
		min_val = 2
		if k * min_val > n:
			if k % 2 == 0:
				print('YES')
				remaining = n - (k - 1)
				print('1 ' * (k - 1) + str(remaining))
			else:
				print('NO')
			continue
		print('YES')
		remaining = n - 2 * (k - 1)
		print('2 ' * (k - 1) + str(remaining))


import sys

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
from math import *
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')
t = int(input())
while t > 0:
	t -= 1
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
		continue
	elif n % 2 == k % 2:
		print('YES')
		for i in range(k):
			if i == k - 1:
				print(n, end=' ')
			else:
				print(1, end=' ')
				n -= 1
		print()
	elif n % 2 == 1:
		print('NO')
		continue
	else:
		if k * 2 > n:
			print('NO')
			continue
		else:
			print('YES')
			for i in range(k):
				if i == k - 1:
					print(n, end=' ')
				else:
					print(2, end=' ')
					n -= 2
		print()


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
	elif n % k == 0:
		print('YES')
		print((str(n // k) + ' ') * k)
	else:
		seq = []
		seq.append(n - (k - 1))
		seq.append(n - (k - 1) * 2)
		if seq[0] % 2 == 1 and seq[0] > 0:
			print('YES')
			print(seq[0], end=' ')
			print('1 ' * (k - 1))
		elif seq[1] % 2 == 0 and seq[1] > 0:
			print('YES')
			print(seq[1], end=' ')
			print('2 ' * (k - 1))
		else:
			print('NO')


for i in range(int(input())):
	(n, k) = map(int, input().split())
	if n % k == 0:
		q = n // k
		print('YES')
		print((str(q) + ' ') * k)
	elif n % 2 == 1 and k == 2:
		print('NO')
	else:
		rem1 = n - (k - 1)
		rem2 = n - 2 * (k - 1)
		if rem1 % 2 == 1 and rem1 > 0:
			print('YES')
			print('1 ' * (k - 1) + str(rem1))
		elif rem2 % 2 == 0 and rem2 > 0:
			print('YES')
			print('2 ' * (k - 1) + str(rem2))
		else:
			print('NO')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split(' '))
	ans = []
	flag = 0
	if n % 2 != 0 and k % 2 == 0:
		print('NO')
	elif n % 2 == 0 and k % 2 != 0:
		if n - (k - 1) * 2 > 0:
			print('YES')
			for j in range(k - 1):
				print(2, end=' ')
			print(n - (k - 1) * 2)
		else:
			print('NO')
	elif n - (k - 1) > 0:
		print('YES')
		for j in range(k - 1):
			print(1, end=' ')
		print(n - (k - 1))
	else:
		print('NO')


t = int(input())
for testcase in range(t):
	args = input().split()
	n = int(args[0])
	k = int(args[1])
	ans = []
	if k <= n:
		if (n - k + 1) % 2 == 1:
			for i in range(k - 1):
				ans.append(1)
			ans.append(n - k + 1)
		elif n - 2 * (k - 1) > 0 and (n - 2 * (k - 1)) % 2 == 0:
			for i in range(k - 1):
				ans.append(2)
			ans.append(n - 2 * (k - 1))
	if len(ans) > 0:
		print('YES')
		for elem in ans:
			print(elem, end=' ')
	else:
		print('NO')


def single_integer():
	return int(input())

def multi_integer():
	return map(int, input().split())

def string():
	return input()

def multi_string():
	return input().split()
t = single_integer()
for i in range(t):
	(n, k) = multi_integer()
	temp_1 = n - (k - 1)
	temp_2 = n - (k - 1) * 2
	if temp_1 > 0:
		if temp_1 % 2 == 1:
			print('YES')
			for j in range(k - 1):
				print(1, end=' ')
			print(temp_1)
			continue
	if temp_2 > 0:
		if temp_2 % 2 == 0:
			print('YES')
			for j in range(k - 1):
				print(2, end=' ')
			print(temp_2)
			continue
	print('NO')


import math as mt
import sys, string
input = sys.stdin.readline
import random
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
t = I()
for i in range(t):
	(n, k) = M()
	a = 1
	if (n - (k - 1) * a) % 2 == 1 and (k - 1) * a < n:
		print('YES')
		print('1 ' * (k - 1) + str(n - (k - 1) * a))
	elif (n - (k - 1) * 2) % 2 == 0 and (k - 1) * 2 < n:
		print('YES')
		print('2 ' * (k - 1) + str(n - (k - 1) * 2))
	else:
		print('NO')


def isodd(a):
	if int(a) % 2 == 0:
		return False
	else:
		return True

def iseven(b):
	if int(b) % 2 == 0:
		return True
	else:
		return False
t = input()
num = []
num_num = []
yes_no = []
kth = []
for i in range(int(t)):
	(n, k) = input().split(' ')
	kth.append(int(k))
	if int(k) > int(n):
		yes_no.append('NO')
	elif int(n) % int(k) == 0:
		yes_no.append('YES')
		num.append(str(int(int(n) / int(k))))
		x = int(int(n) / int(k))
		num_num.append((str(x) + ' ') * (int(k) - 1))
	elif isodd(n) == True and iseven(k) == True:
		yes_no.append('NO')
	elif isodd(n) == True and isodd(k) == True:
		num.append(str(int(int(n) - int(k) + 1)))
		x = int(int(n) - (int(n) - int(k) + 1))
		num_num.append('1 ' * x)
		yes_no.append('YES')
	elif iseven(n) == True and isodd(k) == True:
		if int(n) >= int(k) * 2:
			x = int(int(n) - (int(k) - 1) * 2)
			yes_no.append('YES')
			num.append(str(x))
			num_num.append('2 ' * (int(k) - 1))
		else:
			yes_no.append('NO')
	elif iseven(n) == True and iseven(k) == True:
		if int(n) >= int(k) * 2:
			x = int(int(k) - 1)
			yes_no.append('YES')
			num.append(str(int(n) - int(x) * 2))
			num_num.append('2 ' * x)
		else:
			num.append(str(int(int(n) - int(k) + 1)))
			x = int(int(n) - (int(n) - int(k) + 1))
			num_num.append('1 ' * x)
			yes_no.append('YES')
cnt = 0
for i in range(int(t)):
	if yes_no[i] == 'NO':
		print(yes_no[i])
		cnt += 1
	elif yes_no[i] == 'YES':
		print(yes_no[i])
		print(num[i - cnt], end=' ')
		print(''.join(num_num[i - cnt]))


def solve():
	(N, S) = [int(el) for el in input().split()]
	can = False
	ans = []
	if N % 2 == 1:
		if N - (S - 1) > 0 and (N - (S - 1)) % 2 == 1:
			can = True
			ans = [1 for _ in range(S - 1)]
			ans.append(N - (S - 1))
	else:
		if N - (S - 1) > 0 and (N - (S - 1)) % 2 == 1:
			can = True
			ans = [1 for _ in range(S - 1)]
			ans.append(N - (S - 1))
		if N - 2 * (S - 1) > 0 and (N - 2 * (S - 1)) % 2 == 0:
			can = True
			ans = [2 for _ in range(S - 1)]
			ans.append(N - 2 * (S - 1))
	if can:
		print('YES')
		print(' '.join(map(str, ans)))
	else:
		print('NO')
for t in range(1, int(input()) + 1):
	solve()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	res = []
	if n % 2 != 0 and k % 2 == 0 or n < k:
		res = []
	elif n % k == 0:
		res = [n // k for i in range(k)]
	elif n % 2 != 0 and k % 2 != 0 or (n % 2 == 0 and k % 2 == 0):
		res = [1 for i in range(k - 1)]
		res.append(n - (k - 1))
	else:
		res = [2 for i in range(k - 1)]
		su = sum(res)
		if n - su > 0:
			res.append(n - su)
		else:
			res = []
	if len(res) == 0:
		print('NO')
	else:
		print('YES')
		print(' '.join(map(str, res)))


t = int(input())
for _ in range(t):
	arr = list(map(int, input().split()))
	(num, counter) = (arr[0], arr[1])
	newArr1 = []
	i = 0
	newNum1 = num
	newNum2 = num
	newArr2 = []
	while i < counter - 1:
		newNum1 -= 2
		newArr1.append(2)
		i += 1
	if newNum1 % 2 == 0 and newNum1 > 0:
		newArr1.append(newNum1)
		print('YES')
		print(*newArr1)
	else:
		i = 0
		while i < counter - 1:
			newNum2 -= 1
			newArr2.append(1)
			i += 1
		if newNum2 % 2 != 0 and newNum2 > 0:
			newArr2.append(newNum2)
			print('YES')
			print(*newArr2)
		else:
			print('NO')


t = int(input())
elem = []
res = []
for i in range(t):
	elem.append(list(map(int, input().split())))
for i in elem:
	n = int(i[0])
	num = int(i[1])
	if n % 2 == 1 and num % 2 == 0:
		print('NO')
		continue
	elif n % 2 == 1:
		if num > n:
			print('NO')
		else:
			print('YES')
			s = [1] * (num - 1)
			s.append(n - (num - 1))
			s = list(map(str, s))
			print(' '.join(s))
	elif num % 2 == 1:
		if num * 2 > n:
			print('NO')
		else:
			print('YES')
			s = [2] * (num - 1)
			s.append(n - (num - 1) * 2)
			s = list(map(str, s))
			print(' '.join(s))
	elif num > n:
		print('NO')
	else:
		print('YES')
		s = [1] * (num - 1)
		s.append(n - (num - 1))
		s = list(map(str, s))
		print(' '.join(s))


from math import *
t = int(input())
for i in range(t):
	(n, k) = list(map(int, input().split()))
	l = []
	if k > n:
		print('NO')
		continue
	if n % 2 == 0:
		if n / k >= 2:
			l += (k - 1) * [2]
			val = n - (k - 1) * 2
			if val % 2 == 0:
				print('YES')
				l += [val]
				print(*l)
			else:
				print('NO')
		else:
			l += (k - 1) * [1]
			val = n - (k - 1) * 1
			if val % 2 == 1:
				print('YES')
				l += [val]
				print(*l)
			else:
				print('NO')
	elif k % 2 == 0:
		print('NO')
	else:
		l += (k - 1) * [1]
		val = n - (k - 1) * 1
		if val % 2 == 1:
			print('YES')
			l += [val]
			print(*l)
		else:
			print('NO')


for t in range(int(input())):
	(n, k) = list(map(int, input().split()))
	s = []
	if k > n:
		print('NO')
	elif k == n:
		print('YES')
		for i in range(n):
			print(1, end=' ')
		print()
	else:
		count = 0
		if n % 2 == 0:
			if k % 2 != 0:
				s = []
				while count != k - 1:
					n = n - 2
					count = count + 1
					s.append(2)
				if n <= 0:
					print('NO')
				else:
					s.append(n)
					print('YES')
					print(*s, sep=' ')
			else:
				s = []
				while count != k - 1:
					n = n - 1
					count = count + 1
					s.append(1)
				if n <= 0:
					print('NO')
				else:
					s.append(n)
					print('YES')
					print(*s, sep=' ')
		elif k % 2 != 0:
			s = []
			while count != k - 1:
				n = n - 1
				count = count + 1
				s.append(1)
			if n <= 0:
				print('NO')
			else:
				s.append(n)
				print('YES')
				print(*s, sep=' ')
		else:
			print('NO')


t = int(input())
for _ in range(t):
	(n, k) = input().split(' ')
	n = int(n)
	k = int(k)
	Ans = [0]
	if n < k:
		print('NO')
		continue
	else:
		A = [1 for i in range(k - 1)]
		B = [2 for i in range(k - 1)]
		a = k - 1
		rem = n - a
		if rem > 0 and rem % 2 != 0:
			A.append(rem)
			Ans = A
		a = 2 * (k - 1)
		rem = n - a
		if rem > 0 and rem % 2 == 0:
			B.append(rem)
			Ans = B
	if Ans[0] == 0:
		print('NO')
	else:
		print('YES')
		for i in range(len(Ans)):
			print(Ans[i], end=' ')
		print()


import bisect
from math import pi
from collections import deque
from math import factorial
from math import log, ceil
from collections import defaultdict
from math import *
from sys import stdin, stdout
import itertools
import os
import sys
import threading
from collections import deque, Counter, OrderedDict, defaultdict
from heapq import *
from fractions import Fraction
mod = int(pow(10, 9) + 7)

def ii():
	return int(input())

def si():
	return str(input())

def mi():
	return map(int, input().split())

def li1():
	return list(mi())

def fii():
	return int(stdin.readline())

def fsi():
	return str(stdin.readline())

def fmi():
	return map(int, stdin.readline().split())

def fli():
	return list(fmi())
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)

def make_graph(e):
	d = {}
	for i in range(e):
		(x, y) = mi()
		if x not in d:
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d:
			d[y] = [x]
		else:
			d[y].append(x)
	return d

def gr2(n):
	d = defaultdict(list)
	for i in range(n):
		(x, y) = mi()
		d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans

def primeFactors(n):
	s = set()
	while n % 2 == 0:
		s.add(2)
		n = n // 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			s.add(i)
			n = n // i
	if n > 2:
		s.add(n)
	return s

def find_all(a_str, sub):
	start = 0
	while True:
		start = a_str.find(sub, start)
		if start == -1:
			return
		yield start
		start += len(sub)

def SieveOfEratosthenes(n, isPrime):
	isPrime[0] = isPrime[1] = False
	for i in range(2, n):
		isPrime[i] = True
	p = 2
	while p * p <= n:
		if isPrime[p] == True:
			i = p * p
			while i <= n:
				isPrime[i] = False
				i += p
		p += 1
	return isPrime

def dijkstra(edges, f, t):
	g = defaultdict(list)
	for (l, r, c) in edges:
		g[l].append((c, r))
	(q, seen, mins) = ([(0, f, ())], set(), {f: 0})
	while q:
		(cost, v1, path) = heappop(q)
		if v1 not in seen:
			seen.add(v1)
			path = (v1, path)
			if v1 == t:
				return (cost, path)
			for (c, v2) in g.get(v1, ()):
				if v2 in seen:
					continue
				prev = mins.get(v2, None)
				next = cost + c
				if prev is None or next < prev:
					mins[v2] = next
					heappush(q, (next, v2, path))
	return float('inf')

def binsearch(a, l, r, x):
	while l <= r:
		mid = l + (r - 1) // 2
		if a[mid]:
			return mid
		elif a[mid] > x:
			l = mid - 1
		else:
			r = mid + 1
	return -1

def readTree(n):
	adj = [set() for _ in range(n)]
	for _ in range(n - 1):
		(u, v) = map(int, input().split())
		adj[u - 1].add(v - 1)
		adj[v - 1].add(u - 1)
	return adj

def treeOrderByDepth(n, adj, root=0):
	parent = [-2] + [-1] * (n - 1)
	ordered = []
	q = deque()
	q.append(root)
	depth = [0] * n
	while q:
		c = q.popleft()
		ordered.append(c)
		for a in adj[c]:
			if parent[a] == -1:
				parent[a] = c
				depth[a] = depth[c] + 1
				q.append(a)
	return (ordered, parent, depth)
for _ in range(ii()):
	(n, k) = mi()
	a = []
	b = []
	x = n
	fa = 0
	fb = 0
	for i in range(k - 1):
		if n <= 0:
			fa = 1
			break
		else:
			a.append(1)
			n -= 1
	for i in range(k - 1):
		if x <= 0:
			fb = 1
			break
		else:
			b.append(2)
			x -= 2
	if n % 2 == 1 and fa == 0:
		print('YES')
		a.append(n)
		print(*a)
	elif x % 2 == 0 and fb == 0 and (x > 0):
		print('YES')
		b.append(x)
		print(*b)
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = []
	b = []
	x = n
	fa = 0
	fb = 0
	for i in range(k - 1):
		if n <= 0:
			fa = 1
			break
		else:
			a.append(1)
			n -= 1
	for i in range(k - 1):
		if x <= 0:
			fb = 1
			break
		else:
			b.append(2)
			x -= 2
	if n % 2 == 1 and fa == 0:
		print('YES')
		a.append(n)
		print(*a)
	elif x % 2 == 0 and fb == 0 and (x > 0):
		print('YES')
		b.append(x)
		print(*b)
	else:
		print('NO')


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	breaker = False
	if k == 1:
		print('YES')
		print(n)
		continue
	if n < k or n - k == 1:
		print('NO')
		continue
	for i in range(1, 5):
		if i % 2 == (n - i * (k - 1)) % 2 and n - i * (k - 1) > 0:
			res = [i] * (k - 1) + [n - i * (k - 1)]
			print('YES')
			print(*res)
			breaker = True
			break
	if not breaker:
		print('NO')


from sys import stdin, stdout
from sys import maxsize
input = stdin.readline

def solve():
	pass
test = 1
test = int(input().strip())
for t in range(0, test):
	(n, k) = list(map(int, input().strip().split()))
	if n % 2 == k % 2 and n >= k:
		print('YES')
		print(n - k + 1, end=' ')
		for i in range(k - 1):
			print(1, end=' ')
		print()
	elif n >= 2 * k and n % 2 == 0:
		print('YES')
		print(n - 2 * k + 2, end=' ')
		for i in range(k - 1):
			print(2, end=' ')
		print()
	else:
		print('NO')
	ans = solve()


cas = int(input())
for t in range(cas):
	(n, k) = list(map(int, input().split()))
	if n % k == 0:
		print('YES')
		ar = [n // k for i in range(k)]
		print(' '.join([str(c) for c in ar]))
	elif k > n:
		print('NO')
	elif n % 2 == 1:
		if k % 2 == 0:
			print('NO')
		else:
			ar = []
			ar.append(n - k + 1)
			for i in range(k - 1):
				ar.append(1)
			print('YES')
			print(' '.join([str(c) for c in ar]))
	elif n % 2 == 0:
		if k % 2 == 0:
			if (k - 1) * 2 >= n:
				ar = []
				ar.append(n - k + 1)
				for i in range(k - 1):
					ar.append(1)
				print('YES')
				print(' '.join([str(c) for c in ar]))
			else:
				ar = []
				ar.append(n - (k - 1) * 2)
				for i in range(k - 1):
					ar.append(2)
				print('YES')
				print(' '.join([str(c) for c in ar]))
		else:
			if (k - 1) * 2 >= n:
				print('NO')
				continue
			ar = []
			ar.append(n - (k - 1) * 2)
			for i in range(k - 1):
				ar.append(2)
			print('YES')
			print(' '.join([str(c) for c in ar]))


def main():
	t = int(input())
	for _ in range(t):
		(n, k) = map(int, input().split())
		if n % 2 == 0 and k % 2 == 0:
			if n < k:
				print('NO')
				continue
			else:
				ans = [1] * (k - 1) + [n - k + 1]
		elif n % 2 == 0 and k % 2 == 1:
			if n < k * 2:
				print('NO')
				continue
			else:
				ans = [2] * (k - 1) + [n - (k - 1) * 2]
		elif n % 2 == 1 and k % 2 == 0:
			print('NO')
			continue
		elif n % 2 == 1 and k % 2 == 1:
			if n < k:
				print('NO')
				continue
			else:
				ans = [1] * (k - 1) + [n - k + 1]
		print('YES')
		print(*ans)
main()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	odd = n - (k - 1)
	if odd > 0 and odd % 2 == 1:
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(odd)
		continue
	even = n - (k - 1) * 2
	if even > 0 and even % 2 == 0:
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		print(even)
		continue
	print('NO')


t = int(input())
while t > 0:
	t -= 1
	(n, k) = map(int, input().split())
	if n - k + 1 > 0 and (n - k + 1) % 2 == 1:
		print('YES')
		print('1 ' * (k - 1), n - k + 1)
	elif n - 2 * (k - 1) > 0 and (n - 2 * (k - 1)) % 2 == 0:
		print('YES')
		print('2 ' * (k - 1), n - 2 * (k - 1))
	else:
		print('No')


import math
t = int(input())
for ii in range(t):
	(n, k) = map(int, input().split())
	ans = 0
	res = []
	if n - k + 1 > 0 and (n - k + 1) % 2 == 1:
		print('yes')
		for i in range(k - 1):
			print(1, end=' ')
		print(n - k + 1)
	elif n - 2 * (k - 1) > 0 and (n - 2 * (k - 1)) % 2 == 0:
		print('yes')
		for i in range(k - 1):
			print(2, end=' ')
		print(n - 2 * (k - 1))
	else:
		print('no')


for i in range(int(input())):
	(n, k) = map(int, input().split())
	p = n - k + 1
	q = p - k + 1
	if p > 0 and p & 1 == 1:
		print('YES')
		print(p, '1 ' * (k - 1))
	elif q > 0 and q & 1 == 0:
		print('YES')
		print(q, '2 ' * (k - 1))
	else:
		print('NO')


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	n = a
	k = b
	count = 0
	flag0 = 0
	flag1 = 0
	while count < k - 1:
		a -= 1
		n -= 2
		count += 1
	if a % 2 != 0 and a > 0:
		print('YES')
		flag0 = 1
	elif n % 2 == 0 and n > 0:
		print('YES')
		flag1 = 1
	else:
		print('NO')
	if flag0 == 1:
		for i in range(count):
			print(1, end=' ')
		print(a)
	elif flag1 == 1:
		for i in range(count):
			print(2, end=' ')
		print(n)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
	elif n < k:
		print('NO')
	elif n % 2 == 0 and k % 2 == 1:
		if 2 * k > n:
			print('NO')
		else:
			lst = [2] * (k - 1)
			lst.append(n - 2 * (k - 1))
			print('YES')
			print(*lst)
	else:
		print('YES')
		lst = [1] * (k - 1)
		lst.append(n - k + 1)
		print(*lst)


import sys
n = int(sys.stdin.readline())
for _ in range(n):
	(n, k) = sys.stdin.readline().strip().split()
	(n, k) = (int(n), int(k))
	if n % 2 == 0:
		if n < k or (k % 2 == 1 and n < 2 * k):
			print('NO')
		else:
			print('YES')
			if k % 2 == 0:
				digits = ['1'] * (k - 1) + [str(n - (k - 1))]
			else:
				digits = ['2'] * (k - 1) + [str(n - 2 * (k - 1))]
			print(' '.join(digits))
	elif k % 2 == 0 or k > n:
		print('NO')
	else:
		print('YES')
		digits = ['1'] * (k - 1) + [str(n - (k - 1))]
		print(' '.join(digits))


t = int(input())
for x in range(t):
	(n, k) = [int(x) for x in input().split()]
	if (n - (k - 1)) % 2 == 1 and n - (k - 1) > 0:
		print('YES\n', n - k + 1, *[1 for x in range(k - 1)], '\n')
		continue
	if (n - (2 * k - 2)) % 2 == 0 and n - (2 * k - 2) > 0:
		print('YES\n', n - 2 * k + 2, *[2 for x in range(k - 1)], '\n')
		continue
	print('NO\n')


def solve():
	(n, k) = map(int, input().split())
	if (n - k + 1) % 2 == 1 and n - k + 1 > 0:
		print('YES')
		print(*[1] * (k - 1), n - k + 1, sep=' ')
	elif (n - 2 * (k - 1)) % 2 == 0 and n - 2 * (k - 1) > 1:
		print('YES')
		print(*[2] * (k - 1), n - 2 * (k - 1), sep=' ')
	else:
		print('NO')
t = int(input())
while t:
	t -= 1
	solve()


import math
import time
from collections import defaultdict, deque
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
t = int(input())
for _ in range(t):
	(n, k) = map(int, stdin.readline().split())
	if n % 2 == 0:
		if k % 2 == 0:
			ans = [1] * (k - 1)
			n -= k - 1
			if n <= 0:
				print('NO')
			else:
				ans.append(n)
				print('YES')
				print(*ans)
		else:
			ans = [2] * (k - 1)
			n -= (k - 1) * 2
			if n <= 0:
				print('NO')
			else:
				ans.append(n)
				print('YES')
				print(*ans)
	elif k % 2 == 0:
		print('NO')
	else:
		ans = [1] * (k - 1)
		n -= k - 1
		if n <= 0:
			print('NO')
		else:
			ans.append(n)
			print('YES')
			print(*ans)


t = int(input())
while t > 0:
	(n, k) = map(int, input().split())
	l = []
	if n % 2 != 0 and k % 2 == 0:
		print('NO')
	elif n % 2 != 0 and k % 2 != 0:
		temp = n
		while k > 1 and n > 0:
			l.append(1)
			k -= 1
			n -= 1
		if n > 0:
			l.append(n)
			k -= 1
		if k > 0 or sum(l) != temp:
			print('NO')
		else:
			print('YES')
			print(*l)
	elif n % 2 == 0 and k % 2 != 0:
		temp = n
		while k > 1 and n > 0:
			l.append(2)
			n -= 2
			k -= 1
		if n > 0:
			l.append(n)
			k -= 1
		if k > 0 or sum(l) != temp:
			print('NO')
		else:
			print('YES')
			print(*l)
	elif n // 2 * 2 >= k:
		temp = n
		while k > 1 and n > 0:
			l.append(1)
			k -= 1
			n -= 1
		if n > 0:
			l.append(n)
			k -= 1
		if k > 0 or sum(l) != temp:
			print('NO')
		else:
			print('YES')
			print(*l)
	else:
		temp = n
		while k > 1 and n > 0:
			l.append(2)
			n -= 2
			k -= 1
		if n > 0:
			l.append(n)
			k -= 1
		if k > 0 or sum(l) != temp:
			print('NO')
		else:
			print('YES')
			print(*l)
	t -= 1


from sys import stdin, stdout
import math, sys
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
import bisect as bi
import heapq

def I():
	return int(input())

def In():
	return map(int, input().split())

def main():
	try:
		(n, k) = In()
		flag = 0
		ans = []
		q = 0
		if n < k:
			flag = 1
		else:
			if n == k:
				for i in range(k):
					ans.append(1)
					q = 1
			if n & 1 != 1 and q == 0:
				if k & 1 == 1:
					if n >= 2 * k:
						for i in range(k - 1):
							ans.append(2)
						ans.append(n - 2 * (k - 1))
					else:
						flag = 1
				else:
					for i in range(k - 1):
						ans.append(1)
					ans.append(n - (k - 1))
			elif q == 0 and n & 1 == 1:
				if k & 1 == 1:
					if n >= k:
						for i in range(k - 1):
							ans.append(1)
						ans.append(n - (k - 1))
				else:
					flag = 1
		if flag == 0:
			print('YES')
			print(*ans)
		else:
			print('NO')
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(I()):
	main()


from sys import stdin
from math import gcd
inp = lambda : stdin.readline().strip()
t = int(inp())
for _ in range(t):
	(n, k) = [int(x) for x in inp().split()]
	ans = []
	if n % 2 and (not k % 2):
		print('NO')
	else:
		if not n % 2 and k % 2:
			ans.append(n - 2 * (k - 1))
			ans.extend([2] * (k - 1))
		else:
			ans.append(n - (k - 1))
			ans.extend([1] * (k - 1))
		print('YES' if min(ans) > 0 else 'NO')
		if min(ans) > 0:
			print(*ans)


n = int(input())
for i in range(n):
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	if (a - b) % 2 == 0 and a - b > -1 or ((a - 2 * b) % 2 == 0 and a - 2 * b > -1):
		print('YES')
		if (a - b) % 2 == 0 and a - b > -1:
			l = [1] * (b - 1)
			l.append(a - b + 1)
			l = [str(x) for x in l]
			print(' '.join(l))
		elif (a - 2 * b) % 2 == 0 and a - 2 * b > -1:
			l = [2] * (b - 1)
			l.append(a - 2 * b + 2)
			l = [str(x) for x in l]
			print(' '.join(l))
	else:
		print('NO')


for x in range(int(input())):
	(a, b) = list(map(int, input().split()))
	if a == b:
		print('YES')
		print('1 ' * a)
	elif a % b == 0:
		print('YES')
		print(*[str(a // b) for x in range(b)])
	elif b > a or a - b == 1 or (a % 2 == 1 and b == 2):
		print('NO')
	elif a % 2 == b % 2:
		print('YES')
		print('1 ' * (b - 1) + str(a - b + 1))
	elif (a - 2 * (b - 1)) % 2 == 0 and a - 2 * (b - 1) > 0:
		print('YES')
		print('2 ' * (b - 1) + str(a - 2 * b + 2))
	else:
		print('NO')


T = int(input())
for t in range(T):
	(n, k) = list(map(int, input().split()))
	pair = True
	impossible = False
	if k == 1:
		print('YES')
		print(n)
		continue
	if n % 2 == 0:
		if k % 2 == 0:
			pair = False
		else:
			pair = True
	elif k % 2 == 0:
		impossible = True
	else:
		pair = False
	first_elt = 2 if pair else 1
	res = [first_elt] * (k - 1)
	remaining = n - sum(res)
	if remaining >= 1:
		if remaining % 2 == 0 and pair:
			res.append(remaining)
		elif remaining % 2 == 1 and (not pair):
			res.append(remaining)
		else:
			impossible = True
	else:
		impossible = True
	if impossible:
		print('NO')
	else:
		print('YES')
		print(' '.join(map(str, res)))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	arr = []
	flag = 0
	c = ''
	lastodd = a - (b - 1)
	lasteven = a - 2 * (b - 1)
	if lastodd > 0 and lastodd % 2 == 1:
		flag = 1
		arr = [1 for _ in range(b)]
		arr[len(arr) - 1] = lastodd
	if lasteven > 0 and lasteven % 2 == 0:
		flag = 1
		arr = [2 for _ in range(b)]
		arr[len(arr) - 1] = lasteven
	if flag == 0:
		print('NO')
	if flag == 1:
		print('YES')
		for i in arr:
			c = c + str(i) + ' '
		print(c)


n = int(input())
for i in range(n):
	(n, k) = [int(i) for i in input().split()]
	if n % 2 and (not k % 2) or k > n:
		print('NO')
	else:
		ans = [1] * (k - 1)
		ost = n - (k - 1)
		if ost % 2 and ost > 0:
			ans += [ost]
			print('YES')
			print(*ans)
		else:
			ans = [2] * (k - 1)
			ost = n - (k - 1) * 2
			if not ost % 2 and ost > 0:
				ans += [ost]
				print('YES')
				print(*ans)
			else:
				print('NO')


import sys
I = sys.stdin.readline
pr = sys.stdout.write

def main():
	for _ in range(int(I())):
		(n, k) = map(int, I().split())
		if n & 1:
			if k & 1 and n >= k:
				pr(f"YES\n{'1 ' * (k - 1)}{n - k + 1}\n")
			else:
				pr('NO\n')
		elif n >= 2 * k:
			pr(f"YES\n{'2 ' * (k - 1)}{n - 2 * (k - 1)}\n")
		elif n >= k and (not k & 1):
			pr(f"YES\n{'1 ' * (k - 1)}{n - k + 1}\n")
		else:
			pr('NO\n')
main()


from sys import stdin

def main():
	input = lambda : stdin.readline()[:-1]
	T = int(input())
	for _ in [0] * T:
		(N, K) = map(int, input().split())
		if K == 1:
			print('YES')
			print(N)
			continue
		for i in range(1, 3):
			ans = []
			n = N
			for _ in range(K - 1):
				ans.append(i)
				n -= i
			ans.append(n)
			if ans[-1] % 2 == ans[-2] % 2 and ans[-1] > 0:
				print('YES')
				print(*ans)
				break
		else:
			print('NO')
main()


for i in range(int(input())):
	datos = input().split()
	casos = int(datos[1]) - 1
	respuesta = []
	bandera = True
	if (int(datos[0]) - casos * 2) % 2 == 0 and int(datos[0]) - casos * 2 > 0:
		respuesta.append('YES')
		cadena = str(int(datos[0]) - casos * 2)
		for j in range(casos):
			cadena = cadena + ' ' + '2'
		respuesta.append(cadena)
		print(respuesta[0] + '\n' + respuesta[1])
		bandera = False
	if (int(datos[0]) - casos) % 2 != 0 and int(datos[0]) - casos > 0 and bandera:
		respuesta.append('YES')
		cadena = str(int(datos[0]) - casos)
		for j in range(casos):
			cadena = cadena + ' ' + '1'
		respuesta.append(cadena)
		print(respuesta[0] + '\n' + respuesta[1])
		bandera = False
	if bandera:
		print('NO')


t = int(input())
for i in range(t):
	nk = list(map(int, input().split()))
	n = nk[0]
	k = nk[1]
	a = []
	if k > n:
		print('NO')
	elif k == n:
		for j in range(n):
			a.append(1)
		print('YES')
		print(' '.join((str(i) for i in a)))
	elif n % 2 == 0:
		if n >= k * 2:
			for j in range(k):
				a.append(2)
			a[0] += n - 2 * k
			print('YES')
			print(' '.join((str(i) for i in a)))
		elif k % 2 == 0 and (n - k) % 2 == 0:
			for j in range(k):
				a.append(1)
			a[0] += n - k
			print('YES')
			print(' '.join((str(i) for i in a)))
		else:
			print('NO')
	elif k % 2 == 0:
		print('NO')
	else:
		for j in range(k):
			a.append(1)
		a[0] += n - k
		print('YES')
		print(' '.join((str(i) for i in a)))


t = int(input())
for t in range(t):
	(n, k) = [int(i) for i in input().split(' ')]
	ans = []
	n1 = n2 = n
	n1 -= k - 1
	n2 -= 2 * (k - 1)
	if n1 % 2 == 1 and n1 > 0:
		print('YES')
		print('1 ' * (k - 1) + str(n1))
	elif n2 % 2 == 0 and n2 > 0:
		print('YES')
		print('2 ' * (k - 1) + str(n2))
	else:
		print('NO')


t = int(input())
for it in range(t):
	(n, k) = [int(x) for x in input().split()]
	if k == 1:
		print('YES')
		print(n)
	elif n % k == 0:
		print('YES')
		for i in range(k):
			print(n // k, end=' ')
		print('')
	else:
		h1 = n - (k - 1)
		h2 = n - 2 * (k - 1)
		if h1 % 2 and h1 > 0:
			print('YES')
			for i in range(k - 1):
				print('1', end=' ')
			print(h1)
		elif h2 % 2 == 0 and h2 > 0:
			print('YES')
			for i in range(k - 1):
				print('2', end=' ')
			print(h2)
		else:
			print('NO')


import math
a = int(input())
for j in range(0, a):
	ar = []
	for i in input().split(' '):
		ar.append(int(i))
	if ar[1] > ar[0]:
		print('NO')
		continue
	if ar[1] % 2 == 0 and ar[0] % 2 == 1:
		print('NO')
		continue
	count = ar[0]
	count = count - ar[1] + 1
	if count > 0 and count % 2 == 1:
		temp = [1] * (ar[1] - 1)
		temp.append(count)
		print('YES')
		print(*temp)
		continue
	count = ar[0]
	count = count - 2 * ar[1] + 2
	if count > 0 and count % 2 == 0:
		temp = [2] * (ar[1] - 1)
		temp.append(count)
		print('YES')
		print(*temp)
		continue
	print('NO')


from collections import *
import sys

def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))
t = ri()
for _ in range(t):
	(n, k) = rl()
	if n >= k:
		if n % 2 == k % 2:
			print('YES')
			ans = [1] * (k - 1) + [n - k + 1]
			print(*ans)
		elif n % 2 == 0:
			if n >= 2 * k:
				print('YES')
				ans = [2] * (k - 1) + [n - 2 * (k - 1)]
				print(*ans)
			else:
				print('NO')
		elif n % 2 == 1:
			print('NO')
	else:
		print('NO')


for _ in [0] * int(input()):
	(n, k) = map(int, input().split())
	if n % 2:
		print([f"YES\n{' '.join(map(str, [1] * (k - 1) + [n - k + 1]))}", 'NO'][k % 2 == 0 or k > n])
	elif k % 2:
		print([f"YES\n{' '.join(map(str, [2] * (k - 1) + [n - 2 * (k - 1)]))}", 'NO'][2 * k > n])
	else:
		print([f"YES\n{' '.join(map(str, [1] * (k - 1) + [n - k + 1]))}", 'NO'][k > n])


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	n1 = n - (k - 1)
	if n1 > 0 and n1 % 2 == 1:
		print('YES')
		for i in range(k - 1):
			print('1', end=' ')
		print(n1)
	else:
		n2 = n - 2 * (k - 1)
		if n2 > 0 and n2 % 2 == 0:
			print('YES')
			for i in range(k - 1):
				print('2', end=' ')
			print(n2)
		else:
			print('NO')


tcs = int(input())
for tc in range(tcs):
	(n, k) = map(int, input().split())
	if n % 2 == 0:
		if k % 2 == 1:
			res = [2] * (k - 1) + [n - 2 * (k - 1)]
		else:
			res = [1] * (k - 1) + [n - (k - 1)]
	elif k % 2 == 0:
		res = []
	else:
		res = [1] * (k - 1) + [n - (k - 1)]
	if not res or res[-1] < 1:
		print('NO')
	else:
		print('YES')
		print(*res)


T = int(input())
for test in range(T):
	(n, k) = map(int, input().split())
	if n % 2 != 0 and k % 2 == 0:
		print('NO')
	elif n % 2 != 0:
		if n - (k - 1) > 0 and (n - (k - 1)) % 2 == 1:
			print('YES')
			temp = [1 for _ in range(k - 1)] + [n - (k - 1)]
			for i in temp:
				print(i, end=' ')
			print()
		else:
			print('NO')
	elif n - 2 * (k - 1) > 1 and (n - 2 * (k - 1)) % 2 == 0:
		print('YES')
		temp = [2 for _ in range(k - 1)] + [n - 2 * (k - 1)]
		for i in temp:
			print(i, end=' ')
		print()
	elif n - (k - 1) > 0 and (n - (k - 1)) % 2 == 1:
		print('YES')
		temp = [1 for _ in range(k - 1)] + [n - (k - 1)]
		for i in temp:
			print(i, end=' ')
		print()
	else:
		print('NO')


T = int(input())
for t in range(T):
	(n, k) = list(map(int, input().strip().split(' ')))
	ans = list()
	if n - k + 1 > 0 and n - k + 1 & 1:
		print('YES')
		for i in range(1, k):
			ans.append(str(1))
		ans.append(str(n - k + 1))
		print(' '.join(ans))
	elif n - 2 * k + 2 > 0 and n - 2 * k + 2 & 1 ^ 1:
		print('YES')
		for i in range(1, k):
			ans.append(str(2))
		ans.append(str(n - 2 * k + 2))
		print(' '.join(ans))
	else:
		print('NO')


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n % 2 and (not k % 2):
		print('NO')
	elif n % 2 == 0 and k % 2:
		if n < k * 2:
			print('NO')
		else:
			print('YES')
			print('2 ' * (k - 1) + str(n - (k - 1) * 2))
	elif n < k:
		print('NO')
	else:
		print('YES')
		print('1 ' * (k - 1) + str(n - k + 1))


t = int(input())
n = []
k = []
for i in range(t):
	(inpn, inpk) = map(int, input().split())
	n.append(inpn)
	k.append(inpk)
for i in range(t):
	l = n[i] // 2
	j = k[i]
	if n[i] % 2 == 0 and l // j != 0:
		print('YES')
		rem = -1
		while rem != 0:
			rem = l % j
			if rem != 0:
				print(2 * (l % j), end=' ')
			else:
				print((str(2 * l // j) + ' ') * j)
			l = l - rem
			j = j - 1
	elif n[i] - k[i] >= 0 and (n[i] - k[i]) % 2 == 0:
		l = (n[i] - k[i]) // 2
		j = k[i]
		print('YES')
		rem = -1
		while rem != 0:
			rem = l % j
			if rem != 0:
				print(2 * (l % j) + 1, end=' ')
			else:
				print((str(2 * l // j + 1) + ' ') * j)
			l = l - rem
			j = j - 1
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	ans = [2 for i in range(k - 1)]
	rem = n - 2 * (k - 1)
	done = True
	if rem % 2 == 0 and rem > 0:
		print('YES')
		ans.append(rem)
		print(*ans)
		done = False
	else:
		ans = [1 for i in range(k - 1)]
		rem = n - (k - 1)
		if rem % 2 != 0 and rem > 0:
			print('YES')
			ans.append(rem)
			print(*ans)
			done = False
	if done:
		print('NO')


for i in range(int(input())):
	(a, k) = input().split()
	k = int(k)
	b = int(a)
	lis1 = []
	lis2 = []
	x = b
	x1 = b
	b1 = b
	for i in range(k):
		if i == k - 1:
			w = x - sum(lis1)
			if w > 0 and w % 2 == 0:
				lis1.append(x - sum(lis1))
		else:
			b = b - 2
			lis1.append(2)
	for i in range(k):
		if i == k - 1:
			w1 = x1 - sum(lis2)
			if w1 > 0 and w1 % 2 != 0:
				lis2.append(x1 - sum(lis2))
		else:
			b1 = b1 - 1
			lis2.append(1)
	if sum(lis1) == x and len(lis1) == k:
		print('YES')
		print(*lis1, sep=' ')
	elif sum(lis2) == x1 and len(lis2) == k:
		print('YES')
		print(*lis2, sep=' ')
	else:
		print('NO')


from pprint import pprint
import sys
input = sys.stdin.readline
q = int(input())
for _ in range(q):
	can = False
	(n, k) = map(int, input().split())
	dat = [1] * k
	amari = n - k
	if amari % 2 == 0 and amari >= 0:
		if amari < 0:
			break
		can = True
		dat[0] += amari
		print('YES')
		print(' '.join(list(map(str, dat))))
		continue
	dat = [2] * k
	amari = n - 2 * k
	if amari % 2 == 0 and amari >= 0:
		can = True
		dat[0] += amari
		print('YES')
		print(' '.join(list(map(str, dat))))
		continue
	print('NO')


def sameparity(a, b):
	arr = []
	count = 0
	if a == b:
		arr = [1] * a
		return arr
	if a % 2 == 0:
		if b % 2 == 0:
			while b != 1:
				arr.append(1)
				b -= 1
				count += 1
				if count == a:
					return 'NO'
		else:
			while b != 1:
				arr.append(2)
				b -= 1
				count += 2
				if count == a:
					return 'NO'
		arr.append(a - count)
	else:
		if b % 2 == 0:
			return 'NO'
		else:
			while b != 1:
				arr.append(1)
				b -= 1
				count += 1
				if count == a:
					return 'NO'
		arr.append(a - count)
	return arr
test = int(input())
for i in range(test):
	(a, b) = map(int, input().split())
	z = sameparity(a, b)
	if z == 'NO':
		print(z)
	else:
		print('YES')
		print(*z)


def solution(n, k):
	if n % 2 != 0 and k % 2 == 0:
		print('no')
		return
	if n < k:
		print('no')
		return
	res = []
	if not (n % 2 == 0) ^ (k % 2 == 0):
		res = [1 for _ in range(k - 1)]
		res.append(n - sum(res))
		print('yes')
		print(' '.join(map(str, res)))
		return
	if n % 2 == 0 and k % 2 != 0:
		res = [2 for _ in range(k - 1)]
		if n - sum(res) <= 0:
			print('no')
			return
		res.append(n - sum(res))
		print('yes')
		print(' '.join(map(str, res)))
inp = int(input())
for _ in range(inp):
	input_ = tuple(map(int, input().split()))
	solution(input_[0], input_[1])


import sys
t = int(sys.stdin.readline().strip())
for i in range(0, t):
	(n, k) = list(map(int, sys.stdin.readline().strip().split()))
	if n % 2 == 1:
		if k % 2 == 0:
			print('NO')
		elif n < k:
			print('NO')
		else:
			print('YES')
			print('1 ' * (k - 1) + str(n - k + 1))
	elif k % 2 == 0:
		if n < k:
			print('NO')
		else:
			print('YES')
			print('1 ' * (k - 1) + str(n - k + 1))
	elif n < 2 * k:
		print('NO')
	else:
		print('YES')
		print('2 ' * (k - 1) + str(n - 2 * k + 2))


def main():
	T = int(input())
	for _ in range(T):
		(N, K) = list(map(int, input().split()))
		verdict = False
		res = []
		n = N
		k = K
		if not N & 1 and K & 1:
			if N > 2 * (K - 1):
				for i in range(K - 1):
					res.append(2)
				res.append(N - 2 * (K - 1))
				verdict = True
		elif not N & 1 and (not K & 1):
			if N > K - 1:
				for i in range(K - 1):
					res.append(1)
				res.append(N - (K - 1))
				verdict = True
		elif N & 1 and K & 1:
			if N > K - 1:
				for i in range(K - 1):
					res.append(1)
				res.append(N - (K - 1))
				verdict = True
		if verdict:
			print('YES')
			for i in res:
				print(i, end=' ')
		else:
			print('NO')
main()


t = int(input())
while t > 0:
	t -= 1
	(n, k) = map(int, input().split())
	odd = []
	kg = k
	kc = k
	nc = n
	if n < k:
		print('NO')
		continue
	while kc > 0 and nc > 0:
		odd.append(1)
		kc -= 1
		nc -= 1
	if nc % 2 == 0:
		odd.pop()
		odd.append(nc + 1)
		if len(odd) == kg:
			print('YES')
			for x in odd:
				print(x, end=' ')
			print()
		continue
	even = []
	while k > 0 and n > 0:
		even.append(2)
		k -= 1
		n -= 2
	if n % 2 == 0:
		even.pop()
		even.append(n + 2)
		if len(even) == kg:
			print('YES')
			for x in even:
				print(x, end=' ')
			print()
			continue
	print('NO')


for t in range(int(input())):
	(n, k) = list(map(int, input().split()))
	rem = n % k
	x = n // k
	ans = [x] * k
	if rem == 0:
		ans = [x] * k
	elif x % 2 == 0 and rem % 2 == 1 or (x % 2 == 1 and rem % 2 == 1):
		x1 = [x + rem]
		x2 = [x - 1] * ((k - 1) // 2)
		x3 = [x + 1] * (k - 1 - (k - 1) // 2)
		ans = x1 + x2 + x3
	else:
		ans[0] += rem
	(cnte, cnto, zero) = (0, 0, 0)
	for i in ans:
		if i <= 0:
			zero += 1
		if i % 2 == 0:
			cnte += 1
		else:
			cnto += 1
	if zero == 0 and (cnte == 0 or cnto == 0) and (sum(ans) == n):
		print('YES')
		print(*ans)
	else:
		print('NO')


t = input()
for i in range(int(t)):
	(n, k) = map(int, input().split(' '))
	if n % 2 == 0 and k % 2 == 0:
		if k * 2 <= n:
			print('yes')
			print('2 ' * (k - 1) + str(n - (k - 1) * 2))
		elif k <= n:
			print('yes')
			print('1 ' * (k - 1) + str(n - (k - 1)))
		else:
			print('no')
	elif n % 2 == 0 and k % 2 != 0:
		if k * 2 <= n:
			print('yes')
			print('2 ' * (k - 1) + str(n - (k - 1) * 2))
		else:
			print('no')
	elif n % 2 != 0 and k % 2 == 0:
		print('no')
	elif k <= n:
		print('yes')
		print('1 ' * (k - 1) + str(n - (k - 1)))
	else:
		print('no')


import math
t = int(input())

def fn():
	(n, k) = map(int, input().split())
	ans = list()
	if k > n:
		print('NO')
		return
	if k % 2 == 0:
		if n % 2:
			print('NO')
			return
		else:
			for i in range(k - 1):
				ans.append(1)
			ans.append(n - k + 1)
	elif n % 2:
		for i in range(k - 1):
			ans.append(1)
		ans.append(n - k + 1)
	elif n < 2 * k:
		print('NO')
		return
	else:
		for i in range(k - 1):
			ans.append(2)
		ans.append(n - 2 * k + 2)
	print('YES')
	print(*ans)
while t:
	t -= 1
	fn()


T = int(input())

def ans(n, k):
	if n % 2 == 1 and k % 2 == 0:
		return 'NO'
	if n % 2 == 0 and k % 2 == 1:
		unit = 2
	else:
		unit = 1
	ans = [unit] * (k - 1)
	n -= unit * (k - 1)
	if n <= 0:
		return 'NO'
	return 'YES\n' + ' '.join((str(x) for x in ans + [n]))
for t in range(T):
	(n, k) = input().split(' ')
	(n, k) = (int(n), int(k))
	print(ans(n, k))


def summp(n, k):
	if k > n:
		print('NO')
	elif n % 2 == k % 2:
		print('YES')
		out = [1] * (k - 1)
		out.append(n - k + 1)
		print(*out)
	elif n % 2 == 0 and k % 2 != 0 and (n - 2 * (k - 1) > 0):
		print('YES')
		out = [2] * (k - 1)
		out.append(n - 2 * (k - 1))
		print(*out)
	else:
		print('NO')
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	summp(n, k)


from __future__ import division, print_function
import sys
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
if os.path.exists('in.txt'):
	sys.stdin = open('in.txt', 'r')
if os.path.exists('out.txt'):
	sys.stdout = open('out.txt', 'w')

def input():
	return sys.stdin.readline()

def mapi(arg=0):
	return map(int if arg == 0 else str, input().split())
for _ in range(int(input())):
	(n, k) = mapi()
	if n < k or not (n % 2 == k % 2 or n % 2 == 0) or (n % 2 != k % 2 and n - 2 * k < 0):
		print('NO')
		continue
	res = []
	if n % 2 == k % 2:
		res = [1] * (k - 1)
		res.append(1 + n - k)
	elif n - 2 * k >= 0 and n % 2 == 0:
		res = [2] * (k - 1)
		res.append(2 + n - 2 * k)
	print('YES')
	print(*res)


t = int(input())
for _ in range(t):
	(n, k) = tuple(map(int, input().split()))
	n1 = n - (k - 1)
	if n1 % 2 == 1 and n1 > 0:
		print('YES')
		l = ['1'] * (k - 1) + [str(n1)]
		print(' '.join(l))
	else:
		n2 = n - 2 * (k - 1)
		if n2 % 2 == 0 and n2 > 0:
			print('YES')
			l = ['2'] * (k - 1) + [str(n2)]
			print(' '.join(l))
		else:
			print('NO')


def oddSolution(n, k):
	if k > n:
		return None
	result = []
	for one in range(k - 1):
		result.append('1')
	result.append(str(n - (k - 1)))
	return result

def pairSolution(n, k):
	if k * 2 > n:
		return None
	result = []
	for two in range(k - 1):
		result.append('2')
	result.append(str(n - (k - 1) * 2))
	return result
t = int(input())
for i in range(t):
	line = input().split()
	n = int(line[0])
	k = int(line[1])
	if n % 2 == 0:
		if k % 2 == 0:
			solution = oddSolution(n, k)
		else:
			solution = pairSolution(n, k)
	elif k % 2 == 0:
		solution = None
	else:
		solution = oddSolution(n, k)
	if solution:
		print('YES')
		print(' '.join(solution))
	else:
		print('NO')


loop_runner = int(input())
for x in range(loop_runner):
	(n, k) = map(int, input().split())
	ans = []
	if n % 2 == 0:
		if k % 2 == 0:
			if k > n:
				print('NO')
			else:
				qwerty = n - k
				if qwerty < 0:
					print('NO')
				else:
					print('YES')
					counter = 0
					for i in range(k - 1):
						print(1, end='')
						print(' ', end='')
						counter += 1
					print(n - counter)
		elif n < 2 * k:
			print('NO')
		else:
			qwerty = n - 2 * k
			if qwerty < 0:
				print('NO')
			else:
				print('YES')
				counter = 0
				for i in range(k - 1):
					print(2, end='')
					print(' ', end='')
					counter += 1
				print(n - 2 * counter)
	elif k % 2 == 0:
		print('NO')
	else:
		qwerty = n - k
		if qwerty < 0:
			print('NO')
		else:
			print('YES')
			counter = 0
			for i in range(k - 1):
				print(1, end='')
				print(' ', end='')
				counter += 1
			print(n - counter)


t = int(input())

def solve(n, k):
	if n % 2 == 1 and k % 2 == 0:
		return 'NO'
	if (n % 2 + k % 2) % 2 == 0:
		if k > n:
			return 'NO'
		an = 'YES\n'
		an += ' '.join([str(x) for x in [n - k + 1] + [1] * (k - 1)])
		return an
	if k > n / 2:
		return 'NO'
	an = 'YES\n'
	an += ' '.join([str(x) for x in [n - (k - 1) * 2] + [2] * (k - 1)])
	return an
for _ in range(t):
	(n, k) = [int(x) for x in input().strip().split()]
	print(solve(n, k))


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	if n < k:
		print('NO')
		continue
	if k == 1:
		print('YES')
		print(n)
		continue
	nn = n
	divCnt = k - 1
	nn -= 2 * divCnt
	if nn > 0 and nn % 2 == 0:
		print('YES')
		print(nn, end=' ')
		for i in range(divCnt):
			print(2, end=' ')
		print()
		continue
	nn = n
	nn -= divCnt
	if nn > 0 and nn % 2 == 1:
		print('YES')
		print(nn, end=' ')
		for i in range(divCnt):
			print(1, end=' ')
		print()
		continue
	print('NO')


t = int(input())
for q in range(t):
	(n, k) = [int(i) for i in input().split()]
	first = n - 2 * (k - 1)
	sec = n - k + 1
	if first > 0 and first % 2 == 0:
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		if first != 0:
			print(first)
	elif sec > 0 and sec % 2 != 0:
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		if sec != 0:
			print(sec)
	else:
		print('NO')


def solve():
	c = 0
	(n, k) = map(int, input().split())
	a = (k - 1) * 1
	x = n - k + 1
	b = (k - 1) * 2
	y = n - 2 * k + 2
	if x > 0 and x & 1:
		c = 1
		print('YES')
		print('1 ' * (k - 1) + str(x))
	elif y > 0 and (not y & 1):
		c = 1
		print('YES')
		print('2 ' * (k - 1) + str(y))
	if c == 0:
		print('NO')
for _ in range(int(input())):
	solve()


from sys import stdin
T = int(input())
for _ in range(T):
	(N, K) = map(int, stdin.readline().split())
	ans = []
	if N % 2 == 0:
		if K <= N // 2:
			for i in range(K - 1):
				ans.append(2)
			ans.append(N - 2 * (K - 1))
		elif K % 2 == 0 and K <= N:
			for i in range(K - 1):
				ans.append(1)
			ans.append(N - (K - 1))
		else:
			print('NO')
			continue
	elif N % 2 == 1 and K % 2 == 1 and (K <= N):
		for i in range(K - 1):
			ans.append(1)
		ans.append(N - (K - 1))
	else:
		print('NO')
		continue
	print('YES')
	print(' '.join(map(str, ans)))


Ntc = int(input())
for _ in range(Ntc):
	(tc, Nsummands) = (int(x) for x in input().split(' '))
	if Nsummands > tc:
		print('NO')
	elif tc % 2:
		if Nsummands % 2:
			print('YES')
			print(tc - Nsummands + 1, ('1 ' * (Nsummands - 1))[:-1])
		else:
			print('NO')
	else:
		max_summands = tc / 2
		if Nsummands <= max_summands:
			print('YES')
			print(int((max_summands - Nsummands + 1) * 2), ('2 ' * (Nsummands - 1))[:-1])
		elif Nsummands % 2 == 0:
			print('YES')
			print(tc - Nsummands + 1, ('1 ' * (Nsummands - 1))[:-1])
		else:
			print('NO')


import sys, re, math
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from heapq import heappush, heappop, heapify, nlargest, nsmallest

def STR():
	return list(input())

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST():
	return list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def sortListWithIndex(listOfTuples, idx):
	return sorted(listOfTuples, key=lambda x: x[idx])

def sortDictWithVal(passedDic):
	temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))[::-1]
	toret = {}
	for tup in temp:
		toret[tup[0]] = tup[1]
	return toret

def sortDictWithKey(passedDic):
	return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
t = INT()
while t != 0:
	(n, k) = MAP()
	l = [1] * (k - 1)
	if (n - (k - 1)) % 2 != 0 and n - k + 1 > 0:
		print('YES')
		l.append(n - k + 1)
		print(*l)
	else:
		l = [2] * (k - 1)
		if (n - 2 * (k - 1)) % 2 == 0 and n - 2 * k + 2 > 0:
			print('YES')
			l.append(n - 2 * (k - 1))
			print(*l)
		else:
			print('NO')
	t -= 1


def is_poss(n, k):
	l = []
	if k % 2 == 0 and n % 2 == 1:
		return False
	if k % 2 == n % 2:
		if n >= k:
			for i in range(k - 1):
				l.append('1')
			l.append(str(n - k + 1))
			return l
		else:
			return False
	elif 2 * k <= n:
		for i in range(k - 1):
			l.append('2')
		l.append(str(n - 2 * k + 2))
		return l
	else:
		return False

def main():
	t = int(input())
	for _ in range(t):
		(n, k) = map(int, input().split())
		res = is_poss(n, k)
		if res:
			print('YES')
			print(' '.join(res))
		else:
			print('NO')
main()


t = int(input())
for _ in range(t):
	(n, k) = [int(x) for x in input().split()]
	if n < k or (n % 2 == 1 and k % 2 == 0) or (n % 2 == 0 and k % 2 != 0 and (n < 2 * k)):
		print('NO')
		continue
	print('YES')
	c1 = 0
	c2 = 0
	if n % 2 == 0 and k % 2 == 0:
		c1 = k - 1
		r = n - c1
	elif n % 2 == 0 and k % 2 != 0:
		c2 = k - 1
		r = n - 2 * (k - 1)
	else:
		c1 = k - 1
		r = n - c1
	for i in range(c1):
		print(1, end=' ')
	for i in range(c2):
		print(2, end=' ')
	print(r)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
		continue
	if n % 2 == 0 and 2 * k <= n:
		print('YES')
		for i in range(k):
			if i == k - 1:
				print(n - 2 * (k - 1))
				break
			print(2, end=' ')
	else:
		if k % 2 != n % 2:
			print('NO')
			continue
		print('YES')
		for i in range(k):
			if i == k - 1:
				print(n - 1 * (k - 1))
				break
			print(1, end=' ')


for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
	elif n % 2 == 0 and k % 2 == 1 and (k * 2 > n):
		print('NO')
	else:
		num = 1
		if n % 2 == 0 and k % 2 == 1:
			num = 2
		ans = []
		for i in range(k - 1):
			ans.append(num)
		ans.append(n - num * k + num)
		flag = 1
		for elem in ans:
			if elem <= 0:
				flag = 0
		if flag:
			print('YES')
			print(*ans)
		else:
			print('NO')


def solve(n, k):
	if n - 2 * (k - 1) > 0 and (n - 2 * (k - 1)) % 2 == 0:
		result = [2] * (k - 1)
		result.append(n - 2 * (k - 1))
		return result
	if n - (k - 1) > 0 and (n - (k - 1)) % 2 == 1:
		result = [1] * (k - 1)
		result.append(n - (k - 1))
		return result
	return None
for i in range(int(input())):
	(n, k) = map(int, input().split())
	result = solve(n, k)
	print('YES' if result is not None else 'NO')
	if result is not None:
		print(' '.join(map(str, result)))


for i in range(int(input())):
	(n, m) = map(int, input().split())
	if n < m:
		print('NO')
	elif n % 2 != 0:
		if m % 2 == 0:
			print('NO')
		else:
			print('YES')
			l = [1] * (m - 1)
			l.append(n - (m - 1) * 1)
			print(*l, sep=' ')
	elif m % 2 != 0:
		if n >= 2 * m:
			print('YES')
			l = [2] * (m - 1)
			l.append(n - (m - 1) * 2)
			print(*l, sep=' ')
		else:
			print('NO')
	else:
		print('YES')
		l = [1] * (m - 1)
		l.append(n - (m - 1) * 1)
		print(*l, sep=' ')


for _ in range(int(input())):
	(t, k) = map(int, input().split())
	if t % k == 0:
		res = [int(t / k)] * k
		print('YES')
		print(*res)
	elif t % 2 == 1 and k % 2 == 0:
		print('NO')
	elif t % 2 == 0 and k % 2 == 1:
		res = [2] * (k - 1)
		if sum(res) >= t:
			print('NO')
		else:
			res += [t - (k - 1) * 2]
			print('YES')
			print(*res)
	else:
		res = [1] * (k - 1)
		if sum(res) >= t:
			print('NO')
		else:
			res += [t - (k - 1) * 1]
			print('YES')
			print(*res)


import math
import string

def main_function():
	t = int(input())
	n_k = [[int(k) for k in input().split(' ')] for i in range(t)]
	for i in range(t):
		(n, k) = n_k[i]
		if n < k:
			print('NO')
		elif n % 2 == 0:
			if (n - (k - 1)) % 2 == 1:
				print('YES')
				print(' '.join(['1' for i in range(k - 1)]) + ' ' + str(n - k + 1))
			elif n - 2 * (k - 1) >= 1 and (n - 2 * (k - 1)) % 2 == 0:
				print('YES')
				print(' '.join(['2' for i in range(k - 1)]) + ' ' + str(n - 2 * (k - 1)))
			else:
				print('NO')
		elif k % 2 == 0:
			print('NO')
		else:
			print('YES')
			print(' '.join(['1' for i in range(k - 1)]) + ' ' + str(n - k + 1))
main_function()


def solve(n, k):
	if (n - (k - 1)) % 2 == 1 and n - (k - 1) > 0:
		print('YES')
		ans = [1] * (k - 1)
		ans.append(n - (k - 1))
		print(' '.join((str(x) for x in ans)))
	elif (n - 2 * (k - 1)) % 2 == 0 and n - 2 * (k - 1) > 0:
		print('YES')
		ans = [2] * (k - 1)
		ans.append(n - 2 * (k - 1))
		print(' '.join((str(x) for x in ans)))
	else:
		print('NO')
T = int(input())
for case in range(T):
	solve(*map(int, input().split()))


t = int(input())
tf = []
c = []
s = ''
n = 0
k = 0
for j in range(t):
	s = input()
	n = int(s[:s.find(' ')])
	k = int(s[s.find(' ') + 1:])
	if n % 2 == 1 and k % 2 == 0 or k > n:
		tf.append(False)
		c.append([])
		continue
	elif n % 2 == 0 and k % 2 == 1:
		c.append([2 for i in range(k - 1)])
		c[-1].append(n - 2 * (k - 1))
	elif n % 2 == 0 and k % 2 == 0:
		c.append([1 for i in range(k - 1)])
		c[-1].append(n - k + 1)
	elif n % 2 == 1 and k % 2 == 1:
		c.append([1 for i in range(k - 1)])
		c[-1].append(n - k + 1)
	if c[-1][-1] <= 0:
		tf.append(False)
		continue
	tf.append(True)
for i in range(t):
	print('YES' if tf[i] == True else 'NO')
	if tf[i] == False:
		continue
	for j in c[i]:
		print(j, end=' ')
	print('')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
	elif k == 1:
		print('YES')
		print(n)
	elif n == k:
		print('YES')
		for i in range(n):
			print(1, end=' ')
		print()
	else:
		daru = []
		for i in range(k - 1):
			daru.append(1)
		if (1 + n - k) % 2 == 1 and 1 + n - k > 0:
			daru.append(1 + n - k)
			print('YES')
			for ele in daru:
				print(ele, end=' ')
			print()
		else:
			daru = []
			for i in range(k - 1):
				daru.append(2)
			if (2 + n - 2 * k) % 2 == 0 and 2 + n - 2 * k > 0:
				daru.append(2 + n - 2 * k)
				print('YES')
				for ele in daru:
					print(ele, end=' ')
				print()
			else:
				print('NO')


t = int(input())
while t > 0:
	t -= 1
	(n, k) = map(int, input().split())
	A = []
	if not k % 2 and n % 2:
		print('NO')
	elif not n % 2 and k % 2:
		if 2 * k <= n:
			print('YES')
			L = [2 for i in range(k - 1)]
			L.append(n - 2 * (k - 1))
			A = [str(i) for i in L]
			print(' '.join(A))
		else:
			print('NO')
	elif n >= k:
		print('YES')
		L = [1 for i in range(k - 1)]
		L.append(abs(n - k) + 1)
		A = [str(i) for i in L]
		print(' '.join(A))
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = None
	if n % 2 == 0 and k % 2 == 0:
		if n >= k:
			a = [1] * (k - 1)
			a.append(n - 1 * (k - 1))
	elif n % 2 != 0 and k % 2 == 0:
		pass
	elif n % 2 == 0 and k % 2 != 0:
		if n >= k * 2:
			a = [2] * (k - 1)
			a.append(n - 2 * (k - 1))
	elif n >= k:
		a = [1] * (k - 1)
		a.append(n - 1 * (k - 1))
	if a is None:
		print('NO')
	else:
		print('YES')
		print(' '.join([str(i) for i in a]))


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	a = n % 2
	b = k % 2
	if a == 0 and b == 1:
		ans = n - 2 * (k - 1)
		A = [2] * (k - 1) + [n - 2 * (k - 1)]
	elif a == 0 and b == 0:
		ans = n - (k - 1)
		A = [1] * (k - 1) + [n - (k - 1)]
	elif a == 1 and b == 1:
		ans = n - (k - 1)
		A = [1] * (k - 1) + [n - (k - 1)]
	else:
		ans = -1
	if ans < 1:
		print('NO')
	else:
		print('YES')
		print(*A)


def solve():
	(n, k) = map(int, input().split())
	if (n + k) % 2 == 0:
		if n >= k:
			print('YES')
			for i in range(k - 1):
				print(1)
			print(n - k + 1)
		else:
			print('NO')
	if n % 2 == 0 and k % 2 != 0:
		if n >= 2 * k:
			print('YES')
			for i in range(k - 1):
				print(2)
			print(n - (k - 1) * 2)
		else:
			print('NO')
	if n % 2 != 0 and k % 2 == 0:
		print('NO')
t = int(input())
for _ in range(t):
	solve()


for i1 in range(int(input())):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
	else:
		l1 = []
		if n % 2 == 0:
			if k % 2 == 0 and n % k == 0:
				l1 = [n // k] * k
			elif k % 2 == 0:
				l1 = [1] * k
				l1[0] = n - k + 1
			elif k % 2 != 0 and k > n // 2:
				print('NO')
			elif k % 2 != 0 and k <= n // 2:
				l1 = [2] * k
				l1[0] = n - k * 2 + 2
		elif k % 2 == 0:
			print('NO')
		elif k % 2 != 0:
			l1 = [1] * k
			l1[0] = n - k + 1
		if len(l1) >= 1:
			print('YES')
			for i in l1:
				print(i, end=' ')
			print()


t = int(input())
while t != 0:
	(n, k) = map(int, input().split())
	if k > n:
		print('No')
	elif n % 2 == 0:
		if k % 2 == 0:
			A = [1] * (k - 1)
			A.append(n - (k - 1))
			print('Yes')
			print(*A)
		elif k > n // 2:
			print('No')
		else:
			A = [2] * (k - 1)
			A.append(n - 2 * (k - 1))
			print('Yes')
			print(*A)
	elif k % 2 == 0:
		print('No')
	else:
		A = [1] * (k - 1)
		A.append(n - (k - 1))
		print('Yes')
		print(*A)
	t -= 1


n = int(input())
for _ in range(n):
	(n, m) = map(int, input().split())
	(ans1, ans2) = ([], [])
	(m1, m2) = (m, m)
	while m1 != 1:
		ans1.append(1)
		m1 -= 1
	while m2 != 1:
		ans2.append(2)
		m2 -= 1
	M1 = n - sum(ans1)
	M2 = n - sum(ans2)
	valid = False
	if M1 % 2 == 1 and M1 > 0:
		ans1.append(M1)
		valid = True
		print('YES')
		print(' '.join(map(str, ans1)))
	elif M2 % 2 == 0 and M2 > 0:
		valid = True
		ans2.append(M2)
		print('YES')
		print(' '.join(map(str, ans2)))
	else:
		print('NO')


def solve(n, k):
	if n % 2 == 1 and n >= k and (k % 2 == 1):
		return ['1' for _ in range(k - 1)] + [str(n - k + 1)]
	if n % 2 == 0 and n >= k and (k % 2 == 0):
		return ['1' for _ in range(k - 1)] + [str(n - k + 1)]
	if n % 2 == 0 and k <= n // 2:
		return ['2' for _ in range(k - 1)] + [str(n - 2 * (k - 1))]
	return []
amount = int(input())
for i in range(amount):
	(n, k) = map(int, input().split())
	ans = solve(n, k)
	if len(ans) == 0:
		print('NO')
	else:
		print('YES')
		print(' '.join(ans))


import sys

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())

def solve():
	(n, k) = mints()
	for i in range(2):
		v = [2, 1][i]
		if n >= v * k and k * v % 2 == n % 2:
			print('YES')
			for i in range(k - 1):
				print(v, end=' ')
			print(n - (k - 1) * v)
			return
	print('NO')
for i in range(mint()):
	solve()


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	l = []
	key = 1
	if n % 2 == 1 and k % 2 == 0:
		key = 0
	elif n % 2 == 1 and k % 2 == 1 and (n >= k):
		for _ in range(k - 1):
			l.append(1)
		l.append(n - k + 1)
	elif n % 2 == 0 and k % 2 == 1 and (n >= 2 * k):
		for _ in range(k - 1):
			l.append(2)
		l.append(n - 2 * k + 2)
	elif n % 2 == 0 and k % 2 == 0 and (n >= k):
		for _ in range(k - 1):
			l.append(1)
		l.append(n - k + 1)
	else:
		key = 0
	if key:
		print('YES')
		print(*l)
	else:
		print('NO')


t = int(input())
for y in range(t):
	(n, k) = map(int, input().split())
	ans = []
	f = 1
	if n & 1 == k & 1:
		for i in range(k - 1):
			ans.append(1)
		ans.append(n - k + 1)
		if ans[-1] < 0:
			f = 0
	elif n % 2 == 0:
		for i in range(k - 1):
			ans.append(2)
		ans.append(n - 2 * (k - 1))
		if ans[-1] <= 0:
			f = 0
	else:
		f = 0
	if f == 0:
		print('NO')
	else:
		print('YES')
		print(*ans)


for _ in range(int(input())):
	(n, k) = map(int, input().split(' '))
	last = n - k + 1
	if last > 0 and last % 2 == 1:
		print('YES')
		res = [1] * (k - 1) + [last]
		print(' '.join(map(str, res)))
		continue
	last = n - 2 * (k - 1)
	if last > 0 and last % 2 == 0:
		print('YES')
		res = [2] * (k - 1) + [last]
		print(' '.join(map(str, res)))
		continue
	print('NO')


W = int(input())
for i in range(W):
	X = input()
	for E in range(len(X)):
		u = X[E]
		if u == ' ':
			N = int(X[0:E])
			k = int(X[E + 1:-1] + X[-1])
	r = N % 2
	a = k % 2
	q = ''
	if k > N:
		print('NO')
	elif r == 0:
		if a == 1:
			if 2 * k > N:
				print('NO')
			else:
				print('YES')
				for i in range(k - 1):
					q += '2 '
				c = N - 2 * (k - 1)
				q += str(c)
				print(q)
		else:
			print('YES')
			for i in range(k - 1):
				q += '1 '
			c = N - (k - 1)
			q += str(c)
			print(q)
	elif a == 0:
		print('NO')
	else:
		print('YES')
		for i in range(k - 1):
			q += '1 '
		c = N - (k - 1)
		q += str(c)
		print(q)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	p = b - 1
	if p + 1 > a or p == a:
		print('NO')
		continue
	if (a - p) % 2 != 0:
		print('YES')
		for x in range(p):
			print(1, end=' ')
		print(a - p)
		continue
	k = 2 * (b - 1)
	if k + 2 > a or k == a:
		print('NO')
		continue
	if (a - k) % 2 == 0:
		print('YES')
		l = [2] * p
		l.append(a - k)
		print(*l)
	else:
		print('NO')


def read_tokens():
	return input().strip().split(' ')

def read_ints():
	return [int(s) for s in read_tokens()]

def solve(n: int, k: int) -> list:
	ans = []
	if n < k:
		return ans
	if n % 2 != 0 and k % 2 == 0:
		return ans
	if n % k == 0:
		return [n // k] * k
	if n == k:
		return [1] * k
	if n % 2 == 0 and k % 2 != 0:
		if n < 2 * k:
			return []
		for i in range(k - 1):
			ans.append(2)
		ans.append(n - 2 * (k - 1))
		return ans
	if n % 2 == 0 and k % 2 == 0 or (n % 2 != 0 and k % 2 != 0):
		for i in range(k - 1):
			ans.append(1)
		ans.append(n - (k - 1))
		return ans
	return []
T = int(input())
for test in range(T):
	(n, k) = read_ints()
	arr = solve(n, k)
	if len(arr) == 0:
		print('NO')
		continue
	print('YES')
	for el in arr:
		print(el, end=' ')
	print()


import math

def check(arr):
	par = arr[0] % 2
	for a in arr:
		if a % 2 != par:
			return False
	return True
for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	if (n - k + 1) % 2 != 0 and n - k + 1 > 0:
		arr = ['1'] * (k - 1)
		arr.append(str(n - k + 1))
		print('YES')
		print(' '.join(arr))
		continue
	if (n - 2 * (k - 1)) % 2 == 0 and n - 2 * (k - 1) > 0:
		arr = ['2'] * (k - 1)
		arr.append(str(n - 2 * (k - 1)))
		print('YES')
		print(' '.join(arr))
		continue
	print('NO')


from collections import Counter as C, defaultdict as D, deque as Q
from operator import itemgetter as I
from itertools import product as P
from bisect import bisect_left as BL, bisect_right as BR
from heapq import heappush as HPUSH, heappop as HPOP
from math import floor as MF, ceil as MC, gcd as MG, factorial as F, sqrt as SQRT, inf as INFINITY, log as LOG
from sys import stdin, stdout
INPUT = stdin.readline
PRINT = stdout.write

def player1():
	print('')

def player2():
	print('')

def isPrime(n):
	for i in range(2, MC(SQRT(n)) + 1):
		if n % i == 0:
			return False
	return True

def factors(x):
	ans = []
	for i in range(1, MC(SQRT(x)) + 1):
		if x % i == 0:
			ans.append(i)
			if x % (x // i) == 0:
				ans.append(x // i)
	return ans

def main():
	for _ in range(int(INPUT())):
		(n, k) = map(int, input().split())
		ans = [1] * (k - 1)
		left = n - sum(ans)
		if left > 0 and left & 1:
			ans.append(left)
		else:
			ans = [2] * (k - 1)
			left = n - sum(ans)
			if left > 0 and (not left & 1):
				ans.append(left)
			else:
				ans = 'NO'
		if ans == 'NO':
			PRINT(ans + '\n')
		else:
			PRINT('yes\n')
			print(*ans)
main()


t = int(input())
while t:
	t -= 1
	(n, k) = map(int, input().split())
	rem = n - k + 1
	if rem > 0 and rem % 2 == 1:
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(rem)
		continue
	rem = n - 2 * (k - 1)
	if rem > 0 and rem % 2 == 0:
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		print(rem)
		continue
	print('NO')


queries = int(input())

def solution():
	(n, k) = map(int, input().split())
	same = (k - 1) * 2
	if same < n - 1:
		rest = n - same
		if rest % 2 == 0:
			print('YES')
			print('2 ' * (k - 1) + str(rest))
			return
	same = k - 1
	if same < n:
		rest = n - same
		if rest % 2 != 0:
			print('YES')
			print('1 ' * (k - 1) + str(rest))
			return
	print('NO')
for _ in range(queries):
	solution()


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = n % 2
	b = k % 2
	arr = []
	if k > n:
		print('NO')
	elif a == 1 and b == 0:
		print('NO')
	elif a == 0 and b == 1:
		n = n / 2
		if k > n:
			print('NO')
		else:
			print('YES')
			print('2 ' * (k - 1) + str(int(2 + 2 * (n - k))))
	else:
		print('YES')
		print('1 ' * (k - 1) + str(int(1 + n - k)))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	flag = 0
	ans = []
	for i in range(1, 3):
		temp = (k - 1) * i
		if (n - temp) % 2 == 0 and i % 2 == 0 and (temp < n):
			flag = 2
			for j in range(k - 1):
				ans.append(2)
			ans.append(n - temp)
			break
		elif (n - temp) % 2 != 0 and i % 2 != 0 and (temp < n):
			flag = 1
			for j in range(k - 1):
				ans.append(1)
			ans.append(n - temp)
			break
	if flag == 0:
		print('NO')
	else:
		print('YES')
		print(*ans)


from math import *
from copy import *
from heapq import *
from string import *
from random import *
from bisect import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
from collections import defaultdict

def solve(n, k):
	if k > n:
		print('NO')
		return
	else:
		ans = []
		if n & 1:
			if k & 1:
				print('YES')
				for i in range(k - 1):
					ans.append(1)
				ans.append(n - sum(ans))
			else:
				print('NO')
				return
		elif k & 1:
			if 2 * k > n:
				print('NO')
				return
			else:
				print('YES')
				for i in range(k - 1):
					ans.append(2)
				ans.append(n - sum(ans))
		else:
			print('YES')
			for i in range(k - 1):
				ans.append(1)
			ans.append(n - sum(ans))
		print(*ans)
T = int(input())
for _ in range(T):
	(N, K) = list(map(int, stdin.readline().rstrip().split()))
	solve(N, K)


import sys
import math

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]
t = int(input())
for q in range(t):
	(n, k) = inputnums()
	if n % 2 == 1:
		if k % 2 == 0 or k > n:
			print('NO')
		else:
			print('YES')
			for i in range(k - 1):
				print(1, end=' ')
			print(n - k + 1)
	elif k % 2 == 0 and k <= n:
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(n - k + 1)
	elif k % 2 == 1 and k * 2 <= n:
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		print(n - 2 * k + 2)
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	k1 = n - k + 1
	k2 = n - 2 * k + 2
	if k1 > 0 and k1 % 2:
		print('YES')
		print(*[1 for i in range(k - 1)], k1)
	elif k2 > 0 and k2 % 2 == 0:
		print('YES')
		print(*[2 for i in range(k - 1)], k2)
	else:
		print('NO')


import sys
import math

def ii():
	return sys.stdin.readline().strip()

def idata():
	return [int(x) for x in ii().split()]

def solve_of_problem():
	(n, k) = idata()
	(n1, k1) = (n, k)
	if k > n:
		print('NO')
		return
	ans = [1] * k
	n -= k
	ans[0] += n
	if ans[0] % 2 == 1:
		print('YES')
		print(*ans)
		return
	if 2 * k1 > n1:
		print('NO')
		return
	n1 -= 2 * k1
	ans = [2] * k1
	ans[0] += n1
	if ans[0] % 2 == 0:
		print('YES')
		print(*ans)
		return
	print('NO')
	return
for ______ in range(int(ii())):
	solve_of_problem()


def calcNos(A, N):
	S = sum(A)
	while S < N:
		if N - S == len(A) and len(A) % 2 == 0:
			for i in range(len(A) // 2):
				A[i] += 2
				S += 2
		else:
			A[0] += 2
			S += 2
	return A
T = int(input())
for _ in range(T):
	(N, K) = map(int, input().split())
	if N % K == 0:
		print('YES')
		print(' '.join([str(N // K)] * K))
		continue
	if K > N:
		print('NO')
		continue
	if N % 2 == 1 and K % 2 == 0:
		print('NO')
		continue
	if N % 2 == 0 and K % 2 == 1:
		init = N // K
		if init % 2 == 1:
			init -= 1
	elif N % 2 == 1:
		init = N // K
		if init % 2 == 0:
			init -= 1
	else:
		init = N // K
	if init <= 0:
		init = 1
	A = calcNos([init] * K, N)
	if sum(A) == N:
		print('YES')
		print(' '.join(map(str, A)))
	else:
		print('NO')
	continue


t = int(input())
for _ in range(t):
	(n, k) = [int(x) for x in input().split()]
	r = n - k + 1
	e = n - 2 * k + 2
	if r > 0 and r % 2 != 0:
		print('YES')
		for _ in range(k - 1):
			print('1 ', end='')
		print(r)
	elif e > 0 and e % 2 == 0:
		print('YES')
		for _ in range(k - 1):
			print('2 ', end='')
		print(e)
	else:
		print('NO')


for s in [*open(0)][1:]:
	(n, k) = map(int, s.split())
	d = (n - k) % 2 + 1
	print(*(['YES'] + [d] * (k - 1) + [n - k * d + d], ['NO'])[n & ~k & 1 or k * d > n])


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	cand1 = n - (k - 1)
	cand2 = n - 2 * (k - 1)
	if cand1 > 0 and cand1 % 2 == 1:
		print('YES')
		ans = [1] * (k - 1) + [n - (k - 1)]
		print(*ans)
	elif cand2 > 0 and cand2 % 2 == 0:
		print('YES')
		ans = [2] * (k - 1) + [n - 2 * (k - 1)]
		print(*ans)
	else:
		print('NO')


for ad in range(int(input())):
	(n, k) = list(map(int, input().split()))
	if n >= k:
		if n % 2 == 0:
			s = ''
			if n - 2 * k + 2 > 0:
				print('YES')
				s += '2 ' * (k - 1)
				s += str(n - 2 * k + 2)
				print(s)
			else:
				s += '1 ' * (k - 1)
				s += str(n - k + 1)
				if (n - k + 1) % 2 == 1:
					print('YES')
					print(s)
				else:
					print('NO')
		elif k % 2 == 0:
			print('NO')
		else:
			print('YES')
			s = '1 ' * (k - 1)
			s += str(n - k + 1)
			print(s)
	else:
		print('NO')


n = int(input())
for i in range(n):
	z = input().split()
	x = int(z[0])
	y = int(z[1])
	sum = 0
	for l in range(y - 1):
		sum += 1
	if (x - sum) % 2 == 1 and x - sum > 0:
		print('YES')
		print('1 ' * (y - 1) + str(x - sum))
	else:
		sum = 0
		for l in range(y - 1):
			sum += 2
		if (x - sum) % 2 == 0 and x - sum > 0:
			print('YES')
			print('2 ' * (y - 1) + str(x - sum))
		else:
			print('NO')


import sys
ints = (int(x) for x in sys.stdin.read().split())
sys.setrecursionlimit(3000)

def main():
	ntc = next(ints)
	for tc in range(ntc):
		(n, k) = (next(ints) for i in range(2))
		base = 1 if n % 2 == k % 2 else 2
		ans = [base] * (k - 1)
		ans.append(n - sum(ans))
		if ans[-1] > 0 and ans[-1] % 2 == base % 2:
			print('YES')
			print(*ans)
		else:
			print('NO')
	return
main()


integer = int
string = str
length = len

def fun(n, k):
	if n % 2 != 0 and k % 2 == 0:
		print('NO')
	elif n / k == integer(n / k):
		print('YES')
		ans = [integer(n / k)] * k
		print(*ans)
	else:
		temp1 = integer(n / k)
		x = n % k
		if x % 2 == 0 and temp1 != 0:
			print('YES')
			ans = [temp1] * k
			ans[-1] += x
			print(*ans)
		elif n % 2 == 0 and k % 2 != 0:
			temp = temp1 - 1
			if temp != 0:
				ans = [temp] * k
				ans[-1] += n - temp * k
				print('YES')
				print(*ans)
			else:
				print('NO')
		elif n % 2 != 0 and k % 2 != 0:
			temp = temp1 - 1
			if (n - temp * k) % 2 == 0 and temp != 0:
				ans = [temp] * k
				ans[-1] += n - temp * k
				print('YES')
				print(*ans)
			else:
				temp = temp1 + 1
				if (n - temp * k) % 2 == 0 and temp != 0:
					ans = [temp] * k
					ans[-1] += n - temp * k
					print('YES')
					print(*ans)
				else:
					print('NO')
		else:
			temp = temp1 - 1
			if (n - temp * k) % 2 == 0 and temp != 0:
				ans = [temp] * k
				ans[-1] += n - temp * k
				print('YES')
				print(*ans)
			elif (n - temp1 * k) % 2 == 0 and temp1 != 0:
				ans = [temp1] * k
				ans[-1] += n - temp1 * k
				print('YES')
				print(*ans)
			else:
				temp = temp1 + 1
				if (n - temp * k) % 2 == 0 and temp != 0:
					ans = [temp] * k
					ans[-1] += n - temp * k
					print('YES')
					print(*ans)
				else:
					print('NO')

def main():
	for _ in range(int(input())):
		(n, k) = list(map(integer, input().split()))
		if k > n:
			print('NO')
		else:
			fun(n, k)
main()


def solution(n, k):
	(n1, n2) = (n - (k - 1), n - 2 * (k - 1))
	if n1 > 0 and n1 % 2 == 1:
		print('YES')
		print('1 ' * (k - 1), n1)
	elif n2 > 0 and n2 % 2 == 0:
		print('YES')
		print('2 ' * (k - 1), n2)
	else:
		print('NO')
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	solution(n, k)


i = input()

def logic(n, k):
	if n % 2 == 0:
		if k % 2 == 0:
			if n - (k - 1) > 0:
				return 'YES\n' + '1 ' * (k - 1) + str(n - (k - 1))
			return 'NO'
		else:
			if n - 2 * (k - 1) > 0:
				return 'YES\n' + '2 ' * (k - 1) + str(n - 2 * (k - 1))
			return 'NO'
	else:
		if k % 2 == 1:
			if n - (k - 1) > 0:
				return 'YES\n' + '1 ' * (k - 1) + str(n - (k - 1))
			return 'NO'
		return 'NO'
for a in range(0, int(i)):
	[n, k] = [int(x) for x in input().split()]
	print(logic(n, k))


t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	if k % 2 == 0 and n % 2 == 1:
		print('NO')
	elif n < k:
		print('NO')
	elif n % 2 == 0 and k % 2 == 1 and (n < k * 2):
		print('NO')
	else:
		print('YES')
		s = []
		if n % 2 == k % 2:
			s = [1] * (k - 1) + [n - (k - 1)]
		elif n % 2 == 0 and k % 2 == 1:
			s = [2] * (k - 1) + [n - 2 * (k - 1)]
		for el in s:
			print(el, end=' ')


import sys
data = sys.stdin.readlines()

def get_result(n, k):
	if n % 2 == k % 2:
		if n < k:
			return 'NO'
		else:
			result = [1 for i in range(k - 1)] + [n - k + 1]
			return result
	elif k % 2 == 0:
		return 'NO'
	elif n <= 2 * (k - 1):
		return 'NO'
	else:
		result = [2 for i in range(k - 1)] + [n - 2 * (k - 1)]
		return result
for i in range(len(data)):
	if i:
		(n, k) = [int(j) for j in data[i].split(' ')]
		result = get_result(n, k)
		if result == 'NO':
			print(result)
		else:
			print('YES')
			print(' '.join([str(i) for i in result]))


import math
t = int(input())
for _ in range(t):
	flag = 0
	(n, k) = map(int, input().split())
	lis1 = []
	lis2 = []
	lis = []
	if n < k:
		flag = 1
	elif n % 2 != 0:
		if k % 2 == 0:
			flag = 1
		elif k == n:
			for _ in range(k):
				lis.append(1)
		else:
			for _ in range(k - 1):
				lis.append(1)
			if 1 == (n - sum(lis)) % 2 and n - sum(lis) > 0:
				lis.append(n - sum(lis))
			else:
				flag = 1
	elif k == n:
		for _ in range(k):
			lis1.append(1)
		lis = lis1
	else:
		for _ in range(k - 1):
			lis2.append(2)
			lis1.append(1)
		if 0 == (n - sum(lis2)) % 2 and n - sum(lis2) > 0:
			lis2.append(n - sum(lis2))
			lis = lis2
		elif (n - sum(lis1)) % 2 == 1 and n - sum(lis1) > 0:
			lis1.append(n - sum(lis1))
			lis = lis1
		else:
			flag = 1
	if flag == 1:
		print('NO')
	else:
		print('YES')
		for i in range(len(lis)):
			print(lis[i], end=' ')
		print()


t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	if n < k:
		print('NO')
	else:
		check = [1] * (k - 1)
		last = n - sum(check)
		if last % 2 and last > 0:
			check.append(last)
			print('YES')
			print(' '.join(map(str, check)))
		else:
			check1 = [2] * (k - 1)
			last1 = n - sum(check1)
			if not last1 % 2 and last1 > 0:
				check1.append(last1)
				print('YES')
				print(' '.join(map(str, check1)))
			else:
				print('NO')


for i in range(int(input())):
	(x, y) = [int(i) for i in input().split()]
	if y > x or (x % 2 == 1 and y % 2 == 0):
		print('NO')
	elif x % 2 == 0 and y % 2 == 1:
		if x - 2 * (y - 1) <= 0:
			print('NO')
		else:
			print('YES')
			for i in range(y - 1):
				print(2, end=' ')
			print(x - 2 * (y - 1))
	else:
		print('YES')
		for i in range(y - 1):
			print(1, end=' ')
		print(x - (y - 1))


t = int(input())
while t:
	t -= 1
	(a, b) = map(int, input().split())
	if a % 2 == 1 and b % 2 == 1:
		if b > a:
			print('NO')
			continue
	if a % 2 == 0:
		if b % 2 == 1:
			if 2 * b > a:
				print('NO')
				continue
		elif b > a:
			print('NO')
			continue
	if a % 2 == 1 and b % 2 == 0:
		print('NO')
	else:
		print('YES')
		if a % 2 == 1 and b % 2 == 1:
			for i in range(b - 1):
				print(1, end=' ')
			print(a - (b - 1))
		elif a % 2 == 0 and b % 2 == 1:
			for i in range(b - 1):
				print(2, end=' ')
			print(a - 2 * (b - 1))
		elif a % 2 == 0 and b % 2 == 0:
			for i in range(b - 1):
				print(1, end=' ')
			print(a - (b - 1))
		print('\n')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	ans = []
	if n % 2 == 0:
		if k % 2 == 0:
			if n >= k:
				for _ in range(k - 1):
					ans.append(1)
				ans.append(n - k + 1)
		elif n >= 2 * k:
			for _ in range(k - 1):
				ans.append(2)
			ans.append(n - 2 * (k - 1))
	elif k % 2 == 1:
		if n >= k:
			for _ in range(k - 1):
				ans.append(1)
			ans.append(n - k + 1)
	print('YES' if not len(ans) == 0 else 'NO')
	if not len(ans) == 0:
		print(*ans)


from math import floor, ceil
t = int(input())
for i in range(t):
	(n, k) = list(map(int, input().split()))
	if k > n:
		print('NO')
	else:
		ans = False
		even = n - (k - 1) * 2
		if even % 2 == 0 and even > 0:
			ans = True
			print('YES')
			for i in range(k - 1):
				print(2, end=' ')
			print(even)
		if not ans:
			odd = n - (k - 1)
			if odd % 2 == 1:
				print('YES')
				for i in range(k - 1):
					print(1, end=' ')
				ans = True
				print(odd)
		if not ans:
			print('NO')


import collections

def solve(n, k):
	if n % 2 != 0 and k % 2 == 0 or k > n:
		return [False, []]
	(oneChoice, secondChoice) = ([], [])
	if n % 2 != 0 and k % 2 != 0 or (n % 2 == 0 and k % 2 == 0):
		oneChoice = [1 for _ in range(k - 1)] + [n - (k - 1)]
	if n % 2 == 0 and k % 2 == 0 or (n % 2 == 0 and k % 2 != 0):
		secondChoice = [2 for _ in range(k - 1)] + [n - 2 * (k - 1)]
	if sum(oneChoice) == n and oneChoice[-1] > 0:
		return [True, oneChoice]
	elif sum(secondChoice) == n and secondChoice[-1] > 0:
		return [True, secondChoice]
	else:
		return [False, []]
t = int(input().strip())
for i in range(t):
	[n, k] = list(map(int, input().strip().split()))
	(res, arr) = solve(n, k)
	if res:
		print('YES')
		print(' '.join(map(str, arr)))
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	a = []
	(x, y) = (0, 0)
	if n < k:
		print('NO')
	elif n % 2 == 0 and k % 2 == 0 or (n % 2 == 1 and k % 2 == 1):
		while k - 1 > 0:
			a.append(1)
			y += 1
			k -= 1
		s = n - y
		if s > 0 and s % 2 == 1:
			a.append(s)
			print('YES')
			print(*a)
		else:
			print('NO')
	else:
		while k - 1 > 0:
			a.append(2)
			x += 2
			k -= 1
		c = n - x
		if c > 0 and c % 2 == 0:
			a.append(c)
			print('YES')
			print(*a)
		else:
			print('NO')


I = input
for _ in range(int(I())):
	(n, k) = map(int, I().split())
	s = ''
	if n % 2 == 0:
		if k > n // 2:
			if k % 2 == 0 and k <= n:
				s += '1 ' * (k - 1)
				d = n - k
				s += str(1 + d)
				print('YES')
				print(s)
			else:
				print('NO')
		else:
			s += '2 ' * (k - 1)
			s += str(n - 2 * (k - 1))
			print('YES')
			print(s)
	elif k % 2 == 0 or k > n:
		print('NO')
	else:
		s += '1 ' * (k - 1)
		d = n - k
		s += str(1 + d)
		print('YES')
		print(s)


t = int(input())
for k in range(t):
	(n, l) = map(int, input().split())
	count = 0
	if n < l:
		print('NO')
		continue
	if n % 2 == 1 and l % 2 == 0:
		print('NO')
	elif n % 2 == 1 and l % 2 == 1:
		print('YES', end=' ')
		while count < l - 1:
			print(1, end=' ')
			count = count + 1
		print(n - (l - 1))
	elif n % 2 == 0 and l % 2 == 1:
		if l > n // 2:
			print('NO')
		else:
			print('YES', end=' ')
			while count < l - 1:
				print(2, end=' ')
				count = count + 1
			print(n - (l - 1) * 2)
	elif n % 2 == 0 and l % 2 == 0:
		print('YES', end=' ')
		if l <= n // 2:
			while count < l - 1:
				print(2, end=' ')
				count = count + 1
			print(n - (l - 1) * 2)
		else:
			while count < l - 1:
				print(1, end=' ')
				count = count + 1
			print(n - (l - 1))


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	x = a - (b - 1)
	y = a - 2 * (b - 1)
	if x > 0 and x % 2 == 1:
		print('YES')
		print(x, '1 ' * (b - 1))
	elif y > 0 and y % 2 == 0:
		print('YES')
		print(y, '2 ' * (b - 1))
	else:
		print('NO')


from math import gcd, ceil
from collections import defaultdict as dd

def lcm(a, b):
	return a * b // gcd(a, b)

def inin():
	return int(input())

def inar():
	return list(map(int, input().split()))

def ar(element, size):
	return [element for i in range(size)]

def digitsum(num):
	su = 0
	while num:
		su += num % 10
		num //= 10
	return su
for i in range(inin()):
	(n, k) = inar()
	if n % 2 == 0:
		if n < k:
			print('NO')
		else:
			if k % 2 == 0:
				print('YES')
				for i in range(k - 1):
					print(1, end=' ')
				print(n - k + 1)
			if k % 2 == 1:
				if 2 * k > n:
					print('NO')
				else:
					print('YES')
					for i in range(k - 1):
						print(2, end=' ')
					print(n - 2 * (k - 1))
	if n % 2 == 1:
		if n < k:
			print('NO')
		elif k % 2 == 1:
			print('YES')
			for i in range(k - 1):
				print(1, end=' ')
			print(n - k + 1)
		else:
			print('NO')


def odd(n, k):
	h = n - k
	if h < 0 or h % 2 != 0:
		return None
	h = h // 2
	c = h // k
	d = h % k
	arr = [c] * k
	arr[-1] += d
	arr = list(map(lambda x: 2 * x + 1, arr))
	return arr

def even(n, k):
	if n % 2 != 0:
		return None
	h = n // 2
	c = h // k
	if h == 0 or c == 0:
		return None
	d = h % k
	arr = [c] * k
	arr[-1] += d
	arr = list(map(lambda x: 2 * x, arr))
	return arr

def _odd(n, k):
	nn = n - (k - 1)
	if nn > 0 and nn % 2 == 1:
		return '1 ' * (k - 1) + str(nn)

def _even(n, k):
	nn = n - 2 * (k - 1)
	if nn > 0 and nn % 2 == 0:
		return '2 ' * (k - 1) + str(nn)
	return None
t = int(input())
for _ in range(t):
	(n, k) = tuple([int(e) for e in input().split()])
	s1 = _odd(n, k)
	s2 = _even(n, k)
	if not s1 and (not s2):
		print('NO')
		continue
	print('YES')
	if s1:
		print(s1)
	else:
		print(s2)


import sys
import os
import time
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random
import string

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
for _ in range(ii()):
	(n, k) = mi()
	even = n - 2 * (k - 1)
	odd = n - (k - 1)
	if odd > 0 and odd % 2:
		res = [1] * (k - 1) + [odd]
		print('YES')
		prr(res, ' ')
	elif even > 0 and even % 2 == 0:
		res = [2] * (k - 1) + [even]
		print('YES')
		prr(res, ' ')
	else:
		print('NO')


N = int(input())
for _ in range(N):
	(n, k) = map(int, input().split())
	wow = 'NO'
	if k > n:
		pass
	elif n % 2 == 1:
		if k % 2 == 1:
			output = [1] * (k - 1) + [n - k + 1]
			wow = 'YES'
	elif k <= n // 2:
		output = [2] * (k - 1) + [n - 2 * k + 2]
		wow = 'YES'
	elif k % 2 == 0:
		output = [1] * (k - 1) + [n - k + 1]
		wow = 'YES'
	if wow == 'YES':
		print(wow)
		print(*output)
	else:
		print(wow)


import sys

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
		continue
	if n % 2 == 1:
		if k % 2 == 1:
			print('YES')
			for i in range(k - 1):
				print(1, end=' ')
			print(n - k + 1, end=' ')
			print()
		else:
			print('NO')
	elif n / 2 >= k:
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		print(n - 2 * (k - 1), end=' ')
		print()
	elif k % 2 == 0:
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(n - k + 1, end=' ')
		print()
	else:
		print('NO')


for i in range(int(input())):
	(n, m) = map(int, input().split())
	if m > n:
		print('NO')
	elif m == 1:
		print('YES')
		print(n)
	else:
		if (n - m + 1) % 2 != 0 and n - m + 1 > 0:
			print('YES')
			for i in range(m - 1):
				print(1, end=' ')
			print(n - m + 1, end=' ')
		elif (n - (m - 1) * 2) % 2 == 0 and n - (m - 1) * 2 > 0:
			print('YES')
			for i in range(m - 1):
				print(2, end=' ')
			print(n - (m - 1) * 2, end=' ')
		else:
			print('NO')
		print()


t = int(input())
for i in range(t):
	(n, k) = tuple(map(int, input().split()))
	if 1 * k == n:
		out = [1] * k
		print('YES')
		print(*out)
		continue
	outeven = [2] * (k - 1)
	neven = n - sum(outeven)
	outeven.append(neven)
	outodd = [1] * (k - 1)
	nodd = n - sum(outodd)
	outodd.append(nodd)
	if outeven[-1] > 0 and outeven[-1] % 2 == 0:
		print('YES')
		print(*outeven)
	elif outodd[-1] > 0 and outodd[-1] % 2 == 1:
		print('YES')
		print(*outodd)
	else:
		print('NO')


t = int(input())
while t:
	(n, k) = map(int, input().split())
	summ1 = k - 1
	rem1 = n - summ1
	flag = 0
	if rem1 % 2 == 1 and rem1 > 0:
		print('YES')
		ans = [1] * (k - 1)
		ans += [rem1]
		print(*ans)
		flag = 1
	else:
		summ2 = 2 * summ1
		rem2 = n - summ2
		if rem2 > 0 and rem2 % 2 == 0:
			print('YES')
			ans = [2] * (k - 1)
			ans += [rem2]
			print(*ans)
			flag = 1
		else:
			print('NO')
	t -= 1


t = int(input())
while t > 0:
	(n, k) = map(int, input().split())
	l = []
	if n % 2 == 0:
		if n / 2 < k and ((n + k) / 2 < k or (n + k) % 2 != 0):
			print('NO')
		elif n / 2 >= k:
			print('YES')
			m = int(n / 2 / k)
			for i in range(1, k):
				l.append(2 * m)
			jog = sum(l)
			l.append(n - jog)
			print(*l)
		elif (n + k) / 2 >= k and (n + k) % 2 == 0:
			print('YES')
			m = int((n + k) / 2 / k)
			for i in range(1, k):
				l.append(2 * m - 1)
			jog = sum(l)
			l.append(n - jog)
			print(*l)
	elif (n + k) % 2 != 0 or (n + k) / 2 < k:
		print('NO')
	else:
		print('YES')
		m = int((n + k) / 2 / k)
		for i in range(1, k):
			l.append(2 * m - 1)
		jog = sum(l)
		l.append(n - jog)
		print(*l)
	t = t - 1


t = int(input())
for i in range(0, t):
	(n, k) = input().split(' ')
	n = int(n)
	k = int(k)
	s1 = n - (k - 1)
	s2 = n - (k - 1) * 2
	if s1 < 0 and s2 < 0:
		print('NO')
	else:
		f = False
		if s1 > 0 and s1 % 2 == 1:
			f = True
			print('YES')
			for j in range(0, k - 1):
				print(1, end=' ')
			print(s1)
		elif s2 > 0 and s2 % 2 == 0:
			f = True
			print('YES')
			for j in range(0, k - 1):
				print(2, end=' ')
			print(s2)
		elif f == False:
			print('NO')


for _ in range(int(input())):
	(N, K) = map(int, input().split())
	List = []
	if N < K:
		print('NO')
	else:
		Rem = N - (K - 1)
		if Rem & 1:
			print('YES')
			L = [1] * K
			L[0] = Rem
			print(*L)
		elif not Rem - (K - 1) & 1 and Rem - (K - 1) > 0:
			print('YES')
			L = [2] * K
			L[0] = Rem - (K - 1)
			print(*L)
		else:
			print('NO')


t = int(input())
for x in range(t):
	l = list(map(int, input().split()))
	k = l[1]
	if l[0] % 2 == 1 and l[1] % 2 == 0:
		print('NO')
	elif l[0] % 2 == 1:
		if l[0] < l[1]:
			print('NO')
		else:
			print('YES')
			s = str(l[0] - l[1] + 1) + ' 1' * (k - 1)
			print(s)
	elif 2 * k <= l[0]:
		print('YES')
		s = str(l[0] - 2 * (l[1] - 1)) + ' 2' * (k - 1)
		print(s)
	elif k > l[0]:
		print('NO')
	elif k % 2 == 1:
		print('NO')
	else:
		print('YES')
		s = str(l[0] - l[1] + 1) + ' 1' * (k - 1)
		print(s)


t = int(input())
ans = []
for s in range(t):
	(n, k) = [int(x) for x in input().split()]
	if k * 1 % 2 != n % 2 and k * 2 % 2 != n % 2 or k > n:
		ans.append([-1])
	elif k * 1 % 2 == n % 2:
		arr = [1 for i in range(k - 1)]
		p = sum(arr)
		if p >= n:
			ans.append([-1])
		elif p != n:
			arr.append(n - p)
			ans.append(arr)
	elif k * 2 % 2 == n % 2:
		arr = [2 for i in range(k - 1)]
		p = sum(arr)
		if p >= n:
			ans.append([-1])
		elif p != n:
			arr.append(n - p)
			ans.append(arr)
m = 0
while m < len(ans):
	if ans[m] == [-1]:
		print('NO')
		m += 1
	else:
		print('YES')
		print(*ans[m])
		m += 1


import math
r1 = lambda : int(input())
rm = lambda : map(int, input().split())
rls = lambda : list(rm())
test = r1()
while test:
	test -= 1
	(n, k) = rm()
	flag = True
	if n % 2 == 0 and k == n - 1 and (n > 2) or n < k or (n % 2 == 0 and k % 2 == 1 and (n < 2 * k)):
		flag = False
	if k % 2 == 0 and n % 2 == 1:
		flag = False
	x = k - 1
	ans = []
	if n % 2 == 0 and k % 2 == 1:
		m = k - 1
		ans = [2] * m
		x = n - 2 * m
		ans.append(x)
	elif n % 2 == 1 or k % 2 == 1 or (n % 2 == 0 and k % 2 == 0 and (n < 2 * k)):
		ans = [1] * x
		x = n - x
		ans.append(x)
	elif n % 2 == 0 and k % 2 == 0:
		m = k - 1
		ans = [2] * m
		x = n - 2 * m
		ans.append(x)
	if flag:
		print('YES')
		print(*ans)
	else:
		print('NO')


t = int(input())

def solve(n, k):
	if n % 2 == 0:
		if k % 2 == 1:
			if n < k * 2:
				print('NO')
				return
			print('YES', flush=False)
			for _ in range(k - 1):
				print('2', end=' ', flush=False)
			print(n - 2 * (k - 1), flush=False)
			return
		if n < k:
			print('NO')
			return
		print('YES', flush=False)
		for _ in range(k - 1):
			print('1', end=' ', flush=False)
		print(n - (k - 1), flush=False)
		return
	if k % 2 == 0:
		print('NO')
		return
	if n < k:
		print('NO')
		return
	print('YES', flush=False)
	for _ in range(k - 1):
		print('1', end=' ', flush=False)
	print(n - (k - 1), flush=False)
	return
for _ in range(t):
	(n, k) = input().split(' ')
	n = int(n)
	k = int(k)
	solve(n, k)


t = int(input())

def solve():
	temp = input().split(' ')
	n = int(temp[0])
	k = int(temp[1])
	if n < k:
		print('NO')
		return
	elif (n - k + 1) % 2 == 1:
		res = [1 for i in range(k - 1)]
		if n - k + 1 <= 0:
			print('NO')
			return
		res.append(n - k + 1)
		print('YES')
		print(*res, sep=' ')
		return
	elif (n - 2 * (k - 1)) % 2 == 0:
		res = [2 for i in range(k - 1)]
		if n - 2 * (k - 1) <= 0:
			print('NO')
			return
		res.append(n - 2 * (k - 1))
		print('YES')
		print(*res, sep=' ')
		return
	else:
		print('NO')
		return
for i in range(t):
	solve()


for _ in range(int(input())):
	solved = False
	(n, k) = list(map(int, input().split()))
	for i in range(1, 3):
		x1 = i
		x2 = n - x1 * (k - 1)
		if x1 * (k - 1) + x2 == n and x1 % 2 == x2 % 2 and (x1 > 0) and (x2 > 0):
			print('YES')
			print((str(x1) + ' ') * (k - 1) + str(x2))
			solved = True
			break
		else:
			x1 = str(n // k + 1)
			x2 = str(n - (k - 1) * (n // k + 1))
			if x1 * (k - 1) + x2 == n and x1 % 2 == x2 % 2 and (x1 > 0) and (x2 > 0):
				print('YES')
				print((str(x1) + ' ') * (k - 1) + str(x2))
				solved = True
				break
	if not solved:
		print('NO')


def solution():
	(n, k) = map(lambda x: int(x), input().split())
	rest = n - (k - 1)
	if rest % 2 == 1 and rest > 0:
		print('YES')
		print(' '.join([' '.join(['1'] * (k - 1)), str(rest)]))
		return
	rest = n - 2 * (k - 1)
	if rest > 0 and rest % 2 == 0:
		print('YES')
		print(' '.join([' '.join(['2'] * (k - 1)), str(rest)]))
		return
	print('NO')
t = int(input())
for i in range(t):
	solution()


def SameParitySummands():
	length = int(input())
	numData = [None for _ in range(length)]
	for i in range(length):
		numData[i] = input()
		numData[i] = numData[i].split(' ')
	result = []
	for elem in numData:
		data = int(elem[0])
		length = int(elem[1])
		terms = findTerms(data, length)
		result.append(terms)
	for elem in result:
		print(elem[0])
		if elem[0] == 'YES':
			for term in elem[1]:
				print(term, end='\t')
			if elem != result[-1]:
				print()

def findTerms(data, length):
	if length == 1:
		return ['YES', [data]]
	elif (data - length) // 2 * 2 == data - length and data - length >= 0:
		minimum = (data - length) // (2 * length) * 2 + 1
		addNum = [minimum for _ in range(length)]
		increasement = data - minimum * length
		addNum[0] += increasement
		return ['YES', addNum]
	elif (data - 2 * length) // 2 * 2 == data - 2 * length and data - 2 * length >= 0:
		minimum = (data - 2 * length) // (2 * length) * 2 + 2
		addNum = [minimum for _ in range(length)]
		increasement = data - minimum * length
		addNum[0] += increasement
		return ['YES', addNum]
	else:
		return ['NO', []]
SameParitySummands()


t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	if n % 2 == 0 and k % 2 == 1:
		a = (k - 1) * 2
		if n > a:
			ans = [2] * (k - 1)
			b = n - a
			if b % 2 == 0:
				ans.append(b)
				print('YES')
				print(' '.join((str(x) for x in ans)))
			else:
				print('NO')
		else:
			print('NO')
	else:
		a = k - 1
		if n > a:
			ans = [1] * (k - 1)
			b = n - a
			if b % 2 == 1:
				ans.append(b)
				print('YES')
				print(' '.join((str(x) for x in ans)))
			else:
				print('NO')
		else:
			print('NO')


from math import ceil
cases = int(input())
for _ in range(cases):
	(n, k) = map(int, input().split())
	if (n - (2 * k - 2)) % 2 == 0 and n - (2 * k - 2) > 0:
		print('YES')
		w = []
		w.append(n - (2 * k - 2))
		for i in range(k - 1):
			w.append(2)
		print(*w)
	elif (n - (k - 1)) % 2 == 1 and n - (k - 1) > 0:
		print('YES')
		w = []
		w.append(n - (k - 1))
		for i in range(k - 1):
			w.append(1)
		print(*w)
	else:
		print('NO')


t = int(input())

def parity(n, k):
	if k % 2 == 0:
		if n % 2 == 1:
			lista = []
		elif k > n:
			lista = []
		else:
			lista = [1] * (k - 1) + [n - k + 1]
	elif n % 2 == 0:
		if 2 * k > n:
			lista = []
		else:
			lista = [2] * (k - 1) + [n - 2 * k + 2]
	elif k > n:
		lista = []
	else:
		lista = [1] * (k - 1) + [n - k + 1]
	return lista
for i in range(t):
	(n, k) = input().split()
	n = int(n)
	k = int(k)
	lista = parity(n, k)
	if lista == []:
		print('NO')
	else:
		print('YES')
		for j in lista:
			print(j, end=' ')
		print('')


t = int(input())
for j in range(t):
	g = list(map(int, input().split()))
	n = g[0]
	k = g[1]
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
	elif n < k:
		print('NO')
	elif n == k:
		h = [1] * k
		print('YES')
		for i in range(len(h)):
			print(h[i], end=' ')
	elif n % 2 == 0 and k % 2 == 1:
		if n < 2 * k:
			print('NO')
		else:
			c = 0
			d = 0
			h = []
			while d != k - 1:
				c += 2
				h.append(2)
				d += 1
			h.append(n - c)
			print('YES')
			for i in range(len(h)):
				print(h[i], end=' ')
	elif n % 2 == 0 and k % 2 == 0:
		c = 0
		d = 0
		h = []
		while d != k - 1:
			c += 1
			h.append(1)
			d += 1
		h.append(n - c)
		print('YES')
		for i in range(len(h)):
			print(h[i], end=' ')
	elif n < k:
		print('NO')
	else:
		c = 0
		d = 0
		h = []
		while d != k - 1:
			c += 1
			h.append(1)
			d += 1
		h.append(n - c)
		print('YES')
		for i in range(len(h)):
			print(h[i], end=' ')


def sol():
	(x, y) = map(int, input().split())
	if x % y == 0:
		print('YES')
		print((str(x // y) + ' ') * y)
		return
	if x == y:
		print('YES')
		print('1 ' * y)
		return
	if y > x:
		print('NO')
		return
	if (x - 2 * (y - 1)) % 2 == 0 and x > 2 * (y - 1):
		print('YES')
		print(x - 2 * (y - 1), '2 ' * (y - 1))
		return
	elif (x - y + 1) % 2 == 1:
		print('YES')
		print('1 ' * (y - 1), x - y + 1)
		return
	else:
		print('NO')
for n in range(int(input())):
	sol()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	boo = True
	if n % 2 == 0 and k % 2 == 0 or (n % 2 == 1 and k % 2 == 1):
		a = [1] * (k - 1) + [n - k + 1]
	elif (n % 2 == 0 and k % 2 == 1) and n // 2 >= k:
		a = [2] * (k - 1) + [n - 2 * (k - 1)]
	else:
		boo = False
	if n < k:
		boo = False
	if boo:
		print('YES')
		print(*a)
	else:
		print('NO')


t = int(input())
for j in range(t):
	(n, k) = [int(x) for x in input().split()]
	ans = []
	f = 0
	for i in range(k - 1):
		ans.append(1)
	z = n - (k - 1)
	if z % 2 == 1 and z > 0:
		ans.append(z)
		f = 1
	if f == 0:
		f = 0
		ans.clear()
		for i in range(k - 1):
			ans.append(2)
		z = n - (k - 1) * 2
		if z % 2 == 0 and z > 0:
			ans.append(z)
			f = 1
	if f == 1:
		print('YES')
		for i in range(len(ans)):
			print(ans[i], end=' ')
		print()
	else:
		print('NO')


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	an = []
	if a % 2 and (not b % 2):
		print('NO')
	else:
		temp = a // b
		if temp > 0 and temp % 2 ^ (a - (b - 1) * temp) % 2:
			if temp > 1:
				an = [temp - 1] * (b - 1) + [a - (b - 1) * temp + (b - 1)]
				print('YES')
				print(' '.join(list(map(str, an))))
			elif a - (b - 1) * temp - (b - 1) > 0:
				an = [temp + 1] * (b - 1) + [a - (b - 1) * temp - (b - 1)]
				print('YES')
				print(' '.join(list(map(str, an))))
			else:
				print('NO')
		elif temp <= 0:
			print('NO')
		else:
			an = [temp] * (b - 1) + [a - (b - 1) * temp]
			print('YES')
			print(' '.join(list(map(str, an))))


for i in range(int(input())):
	(n, k) = map(int, input().split())
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
		continue
	elif n % 2 == 1 and k % 2 == 1:
		n1 = n
		n -= k
		if n % 2 == 0 and n >= 0:
			n = n1
			ans = []
			print('YES')
			for i in range(k - 1):
				ans.append(1)
			ans.append(n - k + 1)
			print(*ans, sep=' ')
		else:
			print('NO')
	elif n % 2 == 0 and k % 2 == 1:
		n1 = n
		n -= 2 * k
		if n % 2 == 0 and n >= 0:
			n = n1
			ans = []
			print('YES')
			for i in range(k - 1):
				ans.append(2)
			ans.append(n - 2 * k + 2)
			print(*ans, sep=' ')
		else:
			print('NO')
	else:
		cop = n
		n1 = n
		n1 -= 2 * k
		n -= k
		if n % 2 == 0 and n >= 0:
			n = cop
			ans = []
			print('YES')
			for i in range(k - 1):
				ans.append(1)
			ans.append(n - k + 1)
			print(*ans, sep=' ')
		elif n1 % 2 == 0 and n1 >= 0:
			n1 = cop
			ans = []
			print('YES')
			for i in range(k - 1):
				ans.append(2)
			ans.append(n1 - 2 * k + 2)
			print(*ans, sep=' ')
		else:
			print('NO')


def func2(l):
	a0 = int(l[0])
	a1 = int(l[1])
	if (a0 - (a1 - 1)) % 2 != 0 and a0 - (a1 - 1) > 0:
		print('YES')
		for i in range(a1 - 1):
			print('1', end=' ')
		print(a0 - (a1 - 1))
	elif (a0 - (a1 - 1) * 2) % 2 == 0 and a0 - (a1 - 1) * 2 > 0:
		print('YES')
		for i in range(a1 - 1):
			print('2', end=' ')
		print(a0 - (a1 - 1) * 2)
	else:
		print('NO')
n = int(input())
for i in range(n):
	func2(input().split())


for _ in range(int(input())):
	(a, b) = [int(x) for x in input().split(' ')]
	s = ''
	ans = 'YES'
	if a % 2 == 1 and b % 2 == 1:
		if a < b:
			ans = 'NO'
		else:
			s = '1 ' * (b - 1)
			s += str(a - (b - 1))
	elif a % 2 == 1 and b % 2 != 1:
		ans = 'NO'
	elif a % 2 == 0:
		if a < 2 * b:
			if a < b:
				ans = 'NO'
			elif a >= b and b % 2 == 0:
				s = '1 ' * (b - 1)
				s += str(a - (b - 1))
			else:
				ans = 'NO'
		else:
			s = '2 ' * (b - 1)
			s += str(a - 2 * (b - 1))
	print(ans)
	if ans == 'YES':
		print(s)


def solve():
	(n, k) = map(int, input().split())
	if n == k:
		print('YES')
		print('1 ' * k)
	elif n < k:
		print('NO')
	elif n & 1:
		if k % 2 == 0:
			print('NO')
		else:
			print('YES')
			print('1 ' * (k - 1) + str(n - k + 1))
	elif k & 1 and n >= 2 * k:
		print('YES')
		print('2 ' * (k - 1) + str(n - 2 * (k - 1)))
	elif k % 2 == 0:
		print('YES')
		print('1 ' * (k - 1) + str(n - k + 1))
	else:
		print('NO')
for _ in range(int(input())):
	solve()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if k % 2 == 0 and n % 2 != 0:
		print('NO')
		continue
	if n < k:
		print('No')
		continue
	if k % 2 != 0:
		if n % 2 == 0:
			mnp = k * 2
			if n < mnp:
				print('NO')
			else:
				print('YES')
				ans = [2] * (k - 1)
				ans.append(n - sum(ans))
				print(*ans)
		else:
			mnp = k
			if n < mnp:
				print('NO')
			else:
				print('YES')
				ans = [1] * (k - 1)
				ans.append(n - sum(ans))
				print(*ans)
	elif n % 2 == 0:
		mnp = k
		if n < mnp:
			print('NO')
		else:
			print('YES')
			ans = [1] * (k - 1)
			ans.append(n - sum(ans))
			print(*ans)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	(e, o) = (n - 2 * k + 2, n - k + 1)
	if e > 0 and e % 2 == 0:
		print('YES')
		print(str(e), '2 ' * (k - 1))
	elif o > 0 and o % 2:
		print('YES')
		print(str(o), '1 ' * (k - 1))
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
	elif n % 2 == 0:
		li = []
		if k == n:
			li1 = []
			for j in range(k):
				li1.append(1)
			print('YES')
			print(*li1)
		elif k <= n // 2:
			for j in range(k - 1):
				li.append(2)
			li.append(n - sum(li))
			print('YES')
			print(*li)
		elif k >= n // 2:
			li1 = []
			if k % 2 == 0:
				for j in range(k - 1):
					li1.append(1)
				li1.append(n - sum(li1))
				print('YES')
				print(*li1)
			else:
				print('NO')
		else:
			print('NO')
	elif k % 2 == 0:
		print('NO')
	elif k >= n // 2:
		li = []
		for j in range(k - 1):
			li.append(1)
		li.append(n - sum(li))
		print('YES')
		print(*li)
	else:
		li = []
		for j in range(k - 1):
			li.append(1)
		print('YES')
		li.append(n - sum(li))
		print(*li)


for tt in range(int(input())):
	(n, k) = map(int, input().split())
	temp = 1 * (k - 1)
	count = 0
	temp2 = n - temp
	if temp2 > 0:
		if temp2 % 2 != 0:
			ans = [1] * (k - 1)
			ans.append(temp2)
			print('YES')
			print(*ans)
			count = 1
	temp = 2 * (k - 1)
	temp2 = n - temp
	if temp2 > 0:
		if temp2 % 2 == 0:
			ans = [2] * (k - 1)
			ans.append(temp2)
			if count == 0:
				print('YES')
				print(*ans)
				count = 1
	if count == 0:
		print('NO')


for i in range(int(input())):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
	elif k == n:
		print('YES')
		for i in range(k):
			print(1, end=' ')
	elif k % 2 != 0:
		l = 2 * (k - 1)
		z = n - l
		if z % 2 == 0 and l + z == n and (z > 0):
			ans = [2] * (k - 1)
			ans.append(z)
			print('YES')
			print(' '.join(map(str, ans)))
		elif n % 2 != 0 and k % 2 != 0:
			print('YES')
			ans = [1] * (k - 1)
			ans.append(n - (k - 1))
			print(' '.join(map(str, ans)))
		else:
			print('NO')
	else:
		q = k - 1
		w = n - q
		if w % 2 != 0 and w > 0 and (q + w == n):
			ans = [1] * q
			ans.append(w)
			print('YES')
			print(' '.join(map(str, ans)))
		else:
			print('NO')


e = int(input())
for i in range(e):
	(n, k) = map(int, input().split())
	w = k - 1
	q = 2 * (k - 1)
	if (n - w) % 2 != 0 and n - w > 0:
		print('YES')
		print('1 ' * w, n - w, sep='')
	elif (n - q) % 2 == 0 and n - q > 0:
		print('YES')
		print('2 ' * w, n - q, sep='')
	else:
		print('NO')


from sys import stdin
input = stdin.readline

def list_input():
	return list(map(int, input().split()))

def sep_input():
	return map(int, input().split())
for _ in range(int(input())):
	(n, k) = sep_input()
	if n % 2 == 1 and k % 2 == 0 or n < k:
		print('NO')
	elif n == k:
		print('YES')
		print('1 ' * k)
	else:
		a = n // k
		b = n % k
		if b == 0:
			print('YES')
			print((str(a) + ' ') * k)
			continue
		c1 = n // k
		c2 = n // k + 1
		nc1 = k - b
		nc2 = b
		if nc1 % 2 == 1 and nc2 % 2 == 1:
			print('NO')
			continue
		elif nc2 % 2 == 0:
			print('YES')
			ans = (str(c1) + ' ') * nc1 + (str(c2 - 1) + ' ') * (nc2 // 2) + (str(c2 + 1) + ' ') * (nc2 // 2)
			print(ans)
		elif c1 == 1:
			print('NO')
		elif nc1 % 2 == 0:
			print('YES')
			ans = (str(c2) + ' ') * nc2 + (str(c1 - 1) + ' ') * (nc1 // 2) + (str(c1 + 1) + ' ') * (nc1 // 2)
			print(ans)


for w in range(int(input())):
	(n, k) = (int(x) for x in input().split())
	if n < k:
		print('NO')
	elif n % 2:
		if k % 2:
			print('YES')
			print(' '.join(['1'] * (k - 1) + [str(n - k + 1)]))
		else:
			print('NO')
	elif k % 2:
		if n > 2 * (k - 1):
			print('YES')
			print(' '.join(['2'] * (k - 1) + [str(n - 2 * (k - 1))]))
		else:
			print('NO')
	else:
		print('YES')
		print(' '.join(['1'] * (k - 1) + [str(n - k + 1)]))


from sys import stdin

def input():
	return stdin.readline().rstrip()
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	c = 0
	r = ''
	for i in range(k - 1):
		r += '1 '
		c += 1
	if c < n:
		if (n - c) % 2 == 1:
			print('YES')
			print(r, n - c, sep='')
			continue
	else:
		print('NO')
		continue
	c = 0
	r = ''
	for i in range(k - 1):
		r += '2 '
		c += 2
	if c < n:
		if (n - c) % 2 == 0:
			print('YES')
			print(r, n - c, sep='')
			continue
		else:
			print('NO')
			continue
	else:
		print('NO')
		continue


t = int(input())
for loop in range(t):
	(n, k) = map(int, input().split())
	nc = n
	ans = []
	for i in range(k - 1):
		ans.append(1)
		nc -= 1
	if nc % 2 == 1 and nc > 0:
		ans.append(nc)
		print('YES')
		print(*ans)
		continue
	nc = n
	ans = []
	for i in range(k - 1):
		ans.append(2)
		nc -= 2
	if nc % 2 == 0 and nc > 0:
		ans.append(nc)
		print('YES')
		print(*ans)
		continue
	print('NO')


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a % b == 0:
		print('YES')
		base = a // b
		for i in range(b):
			print(base, end=' ')
		print()
	elif a < b:
		print('NO')
	elif a % 2 == 1 and b % 2 == 0:
		print('NO')
	elif a % 2 == 1 and b % 2 == 1:
		ans = []
		print('YES')
		for i in range(b - 1):
			ans.append(1)
		ans.append(a - b + 1)
		print(' '.join(map(str, ans)))
	else:
		ans = []
		ans2 = []
		for i in range(b - 1):
			ans2.append(1)
		rem = a - b + 1
		ans2.append(rem)
		if rem % 2 == 1 and rem > 0 and (sum(ans2) == a):
			print('YES')
			print(' '.join(map(str, ans2)))
		else:
			for i in range(b - 1):
				ans.append(2)
			rem = a - 2 * (b - 1)
			ans.append(rem)
			if rem % 2 == 0 and rem > 0 and (sum(ans) == a):
				print('YES')
				print(' '.join(map(str, ans)))
			else:
				print('NO')


import sys, heapq
from collections import *
from functools import lru_cache
sys.setrecursionlimit(10 ** 6)

def main():
	t = int(input())
	for _ in range(t):
		(n, k) = map(int, input().split(' '))
		(nn, kk) = (n & 1, k & 1)
		(flag, res) = (False, [])
		if nn ^ kk == 0:
			if n >= k:
				flag = True
				res = [n - k + 1] + [1] * (k - 1)
		elif nn == 0 and kk == 1:
			if n >= k * 2:
				flag = True
				res = [n - k * 2 + 2] + [2] * (k - 1)
		if len(res) > 0:
			print('YES')
			print(' '.join(map(str, res)))
		else:
			print('NO')
main()


t = int(input())
for i in range(t):
	s = input()
	n = int(s.split(' ')[0])
	k = int(s.split(' ')[1])
	odd = []
	total = 0
	for i in range(k - 1):
		odd.append(1)
		total += 1
	odd.append(n - total)
	if (n - total) % 2 == 1 and n - total > 0:
		print('YES')
		for j in odd:
			print(j, end=' ')
		print('')
	else:
		even = []
		total = 0
		for k in range(k - 1):
			even.append(2)
			total += 2
		even.append(n - total)
		if (n - total) % 2 == 0 and n - total > 0:
			print('YES')
			for j in even:
				print(j, end=' ')
			print('')
		else:
			print('NO')


t = int(input())
for _ in range(t):
	(n1, n2) = map(int, input().rstrip().split(' '))
	if n1 % 2:
		if n2 % 2:
			if n2 == n1:
				print('YES')
				print('1 ' * n1)
			elif n2 > n1 - 2:
				print('NO')
			else:
				print('YES')
				print('1 ' * (n2 - 1), end='')
				print(str(n1 - n2 + 1))
		elif not n2 % 2:
			print('NO')
	elif n1 == n2:
		print('YES')
		print('1 ' * n2)
	elif n2 % 2:
		if n2 > n1 // 2:
			print('NO')
		else:
			print('YES')
			print('2 ' * (n2 - 1), end='')
			print(str(n1 - 2 * (n2 - 1)))
	elif not n2 % 2:
		if n2 >= n1 - 1:
			print('NO')
		else:
			print('YES')
			print('1 ' * (n2 - 1), end='')
			print(str(n1 - n2 + 1))
	else:
		print('NO')


import copy
iterator = int(input())
while iterator != 0:
	a = input()
	A = a.split(' ')
	t = int(A[0])
	n = int(A[1])
	t2 = copy.copy(t)
	CounterEven = 0
	CounterOdd = 0
	EvenArray = []
	OddArray = []
	FlageEven = False
	FlageOdd = False
	while CounterEven < n - 1:
		t = t - 2
		EvenArray.append(2)
		CounterEven = CounterEven + 1
	if t % 2 == 0 and t > 0:
		EvenArray.append(t)
	if len(EvenArray) == n:
		FlageEven = True
	if FlageEven == False:
		while CounterOdd < n - 1:
			t2 = t2 - 1
			OddArray.append(1)
			CounterOdd = CounterOdd + 1
		if t2 % 2 != 0 and t2 > 0:
			OddArray.append(t2)
		if len(OddArray) == n:
			FlageOdd = True
	if FlageEven:
		print('YES')
		for I in EvenArray:
			print(I, end=' ')
	elif FlageOdd:
		print('YES')
		for I in OddArray:
			print(I, end=' ')
	else:
		print('NO')
	iterator = iterator - 1


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = []
	if n % 2 == 0:
		if k % 2 == 0:
			if k > n:
				print('NO')
			else:
				print('YES')
				for nn in range(k):
					l.append(1)
				l[-1] += n - k
				print(' '.join(map(str, l)))
		elif k * 2 > n:
			print('NO')
		else:
			print('YES')
			for nn in range(k):
				l.append(2)
			l[-1] += n - 2 * k
			print(' '.join(map(str, l)))
	elif k % 2 == 0:
		print('NO')
	elif k > n:
		print('NO')
	else:
		print('YES')
		for nn in range(k):
			l.append(1)
		l[-1] += n - k
		print(' '.join(map(str, l)))


import sys
t = int(input())
for z in range(t):
	(n, k) = map(int, input().rstrip().split())
	m = n % k
	res = [n // k] * k
	temp = [n // k] * k
	bool = True
	flag = True
	if n % k == 0:
		print('YES')
		print(' '.join(map(str, res)))
	elif n < k:
		print('NO')
	else:
		i = 0
		while m > 0:
			res[i] = res[i] + 1
			temp[i] = temp[i] + 1
			i += 1
			m -= 1
		temp.reverse()
		i = 0
		if res[0] % 2 == 0:
			while i + 1 < k and res[i] % 2 == 0 and (res[i + 1] % 2 == 0):
				res[i] -= 1
				if res[i] == 0:
					bool = False
					break
				res[i + 1] += 1
				i += 2
			for i in range(k):
				if res[i] % 2 == 0:
					bool = False
					break
		else:
			while i + 1 < k and res[i] % 2 != 0 and (res[i + 1] % 2 != 0):
				res[i] -= 1
				if res[i] == 0:
					bool = False
					break
				res[i + 1] += 1
				i += 2
			for i in range(k):
				if res[i] % 2 != 0:
					bool = False
					break
		i = 0
		if temp[0] % 2 == 0:
			while i + 1 < k and temp[i] % 2 == 0 and (temp[i + 1] % 2 == 0):
				temp[i] -= 1
				if temp[i] == 0:
					flag = False
					break
				temp[i + 1] += 1
				i += 2
			for i in range(k):
				if temp[i] % 2 == 0:
					flag = False
					break
		else:
			while i + 1 < k and temp[i] % 2 != 0 and (temp[i + 1] % 2 != 0):
				temp[i] -= 1
				if temp[i] == 0:
					flag = False
					break
				temp[i + 1] += 1
				i += 2
			for i in range(k):
				if temp[i] % 2 != 0:
					flag = False
					break
		if bool == False and flag == False:
			print('NO')
		elif flag == False:
			print('YES')
			print(' '.join(map(str, res)))
		else:
			print('YES')
			print(' '.join(map(str, temp)))


from collections import deque
from collections import OrderedDict
import math
import sys
import os
from io import BytesIO
import threading
import bisect
for t in range(int(input())):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
	elif n % 2 == 1 and k % 2 == 1:
		print('YES')
		print(n - (k - 1), end=' ')
		for i in range(k - 1):
			print(1, end=' ')
	elif n % 2 == 0 and n // 2 >= k and (k % 2 != 0):
		print('YES')
		print(n - (k - 1) * 2, end=' ')
		for i in range(k - 1):
			print(2, end=' ')
	elif n % 2 == 0 and k % 2 == 0:
		print('YES')
		print(n - (k - 1), end=' ')
		for i in range(k - 1):
			print(1, end=' ')
	else:
		print('NO')


t = int(input())
for hh in range(0, t):
	(n, k) = [int(x) for x in input().split()]
	x = n - k + 1
	if x % 2 == 1 and x > 0:
		print('YES')
		for i in range(0, k - 1):
			print('1 ', end='')
		print(x)
	else:
		x = n - 2 * (k - 1)
		if x % 2 == 0 and x > 0:
			print('YES')
			for i in range(0, k - 1):
				print('2 ', end='')
			print(x)
		else:
			print('NO')


t = int(input())
for i in range(t):
	(n, k) = [int(i) for i in input().split()]
	if (n - k * 1) % 2 == 0 and abs(n - k * 1) == n - k * 1:
		otvet = []
		for i in range(k):
			otvet.append(1)
		otvet[0] += n - k * 1
		print('YES')
		print(*otvet)
	elif (n - k * 2) % 2 == 0 and abs(n - k * 2) == n - k * 2:
		otvet = []
		for i in range(k):
			otvet.append(2)
		otvet[0] += n - k * 2
		print('YES')
		print(*otvet)
	else:
		print('NO')


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(t):
		(n, k) = map(int, input().split())
		if n < k:
			yield 'NO'
		elif n % 2 == 0:
			if n >= k * 2:
				ans = [2] * (k - 1) + [n - 2 * (k - 1)]
				yield 'YES'
				yield ' '.join((str(x) for x in ans))
			else:
				dd = (3 * k - n) // 2
				dl = (3 * k - n) / 2
				if dd == dl:
					ans = [1] * dd + [3] * (k - dd)
					yield 'YES'
					yield ' '.join((str(x) for x in ans))
				else:
					yield 'NO'
		elif n >= k and k % 2:
			yield 'YES'
			ans = [1] * (k - 1) + [n - (k - 1)]
			yield ' '.join((str(x) for x in ans))
		else:
			yield 'NO'
t = int(input())
ans = gift()
print(*ans, sep='\n')


for u in range(int(input())):
	(n, m) = map(int, input().split())
	(l, d) = ([], [])
	for i in range(m - 1):
		l.append(1)
	l.append(n - m + 1)
	for i in range(m - 1):
		d.append(2)
	d.append(n - 2 * (m - 1))
	(x, y) = (0, 0)
	for i in range(m):
		if l[i] % 2 == 1 and l[i] > 0:
			x = x + 1
	for i in range(m):
		if d[i] % 2 == 0 and d[i] > 0:
			y = y + 1
	if x == m and sum(l) == n:
		print('YES')
		print(*l)
	elif y == m and sum(d) == n:
		print('YES')
		print(*d)
	else:
		print('NO')


import sys, math
input = sys.stdin.readline

def inp():
	return int(input())

def inara():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = inp()
for _ in range(t):
	(n, k) = invr()
	p = n - k + 1
	if p > 0 and p % 2:
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(p)
		continue
	q = n - 2 * (k - 1)
	if q > 0 and q % 2 == 0:
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		print(q)
		continue
	print('NO')


for i in range(int(input())):
	(n, k) = map(int, input().strip().split())
	flag = 0
	if n % 2 == 0 and k % 2 == 0:
		if k <= n // 2:
			print('YES')
			for j in range(k - 1):
				print(2, end=' ')
			print(n - 2 * (k - 1))
		elif (n - (k - 1)) % 2 == 1 and n - (k - 1) > 0:
			print('YES')
			for j in range(k - 1):
				print(1, end=' ')
			print(n - (k - 1))
		else:
			print('NO')
	elif n % 2 == 0 and k % 2 == 1:
		if n - 2 * (k - 1) > 0:
			print('YES')
			for j in range(k - 1):
				print(2, end=' ')
			print(n - 2 * (k - 1))
		else:
			print('NO')
	elif n % 2 == 1 and k % 2 == 0:
		print('NO')
	elif n % 2 == 1 and k % 2 == 1:
		if n - (k - 1) > 0 and (n - (k - 1)) % 2 == 1:
			print('YES')
			for j in range(k - 1):
				print(1, end=' ')
			print(n - (k - 1))
		else:
			print('NO')


t = int(input())
while t:
	t -= 1
	(n, k) = map(int, input().split())
	if n % 2 != 0:
		if k % 2 == 0:
			print('No')
		elif k > n:
			print('No')
		else:
			print('Yes')
			for i in range(k - 1):
				print(1, end=' ')
			print(n - (k - 1))
	elif k % 2 != 0:
		if 2 * k > n:
			print('No')
		else:
			print('Yes')
			for i in range(k - 1):
				print(2, end=' ')
			print(n - 2 * (k - 1))
	elif 2 * k <= n:
		print('yes')
		for i in range(k - 1):
			print(2, end=' ')
		print(n - 2 * (k - 1))
	elif k <= n:
		print('Yes')
		for i in range(k - 1):
			print(1, end=' ')
		print(n - (k - 1))
	else:
		print('No')


query = int(input())
while query > 0:
	query -= 1
	(x, y) = map(int, input().split())
	ok = False
	if x - 2 * (y - 1) >= 2 and (x - 2 * (y - 1)) % 2 == 0:
		print('YES')
		for i in range(1, y):
			print(2, end=' ')
		print(x - 2 * (y - 1))
	elif x - (y - 1) >= 1 and (x - (y - 1)) % 2 == 1:
		print('YES')
		for i in range(1, y):
			print(1, end=' ')
		print(x - (y - 1))
	else:
		print('NO')


T = int(input())
i = 0
while i < T:
	s = input().split()
	n = int(s[0])
	k = int(s[1])
	if (n - k) % 2 == 0 and n >= k:
		print('YES')
		print(*[1] * (k - 1), n - k + 1)
	elif n % 2 == 0 and n - 2 * (k - 1) > 0:
		print('YES')
		print(*[2] * (k - 1), n - 2 * (k - 1))
	else:
		print('NO')
	i += 1


nTest = int(input())
for iTest in range(nTest):
	(n, k) = map(int, input().split())
	if n < k:
		print('NO')
		continue
	if n % 2 == 1:
		if k % 2 == 0:
			print('NO')
		else:
			print('YES')
			print('{}{}'.format('1 ' * (k - 1), n - (k - 1)))
	elif k % 2 == 0:
		print('YES')
		print('{}{}'.format('1 ' * (k - 1), n - (k - 1)))
	elif n < 2 * k:
		print('NO')
	else:
		print('YES')
		print('{}{}'.format('2 ' * (k - 1), n - 2 * (k - 1)))


t = int(input())

def valid(n, k):
	if k > n:
		return []
	if n % 2 == 1 and k % 2 == 0:
		return []
	if n % 2 == k % 2:
		ans = []
		for i in range(k):
			ans.append(1)
		ans[-1] += n - k
		return ans
	ans = []
	if n < 2 * k:
		return False
	for i in range(k):
		ans.append(2)
	ans[-1] += n - 2 * k
	return ans
for case in range(t):
	(n, k) = list(map(int, input().split()))
	ans = valid(n, k)
	if ans:
		print('YES')
		print(' '.join(list(map(str, ans))))
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	x = n // k
	y = n % k
	p = x % 2
	if y:
		if x > 0 and (x + y) % 2 == p:
			print('YES')
			ans = [x] * (k - 1) + [x + y]
			print(*ans)
		elif x - 1 > 0 and (x + y + k - 1) % 2 != p:
			print('YES')
			ans = [x - 1] * (k - 1) + [x + y + k - 1]
			print(*ans)
		else:
			print('NO')
	elif x > 0:
		print('YES')
		ans = [x] * k
		print(*ans)
	else:
		print('NO')


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	(n, k) = list(map(int, stdin.readline().split()))
	if k > n:
		print('NO')
		continue
	each_mx = n // k
	f = 0
	rem = n - each_mx * k
	if each_mx & 1 == each_mx + rem & 1 or rem == 0:
		f = 1
	elif each_mx > 1:
		each_mx -= 1
		rem = n - each_mx * k
		if each_mx & 1 == each_mx + rem & 1:
			f = 1
	if f:
		print('YES')
		l = [each_mx + rem] + [each_mx] * (k - 1)
		print(*l)
	else:
		print('NO')


n = int(input())
for i in range(n):
	(m, k) = input().split()
	m = int(m)
	k = int(k)
	if m < k:
		print('NO')
		continue
	if (m - k + 1) % 2 == 1:
		ans = [1] * (k - 1)
		ans.append(m - k + 1)
		print('YES')
		print(' '.join(list(map(str, ans))))
		continue
	if m - (k - 1) * 2 > 0 and (m - (k - 1) * 2) % 2 == 0:
		ans = [2] * (k - 1)
		ans.append(m - (k - 1) * 2)
		print('YES')
		print(' '.join(list(map(str, ans))))
		continue
	print('NO')


def solution(n, k):
	if n < k:
		return 'NO'
	even = (k - 1) * 2
	odd = k - 1
	if n - even > 0 and (n - even) % 2 == 0:
		ans = [2] * (k - 1)
		ans.append(n - even)
		return ans
	elif n - odd > 0 and (n - odd) % 2 != 0:
		ans = [1] * (k - 1)
		ans.append(n - odd)
		return ans
	return 'NO'
for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	sol = solution(n, k)
	if sol == 'NO':
		print('NO')
	else:
		print('YES')
		print(*sol, sep=' ')


t = int(input())
q = []
for i in range(t):
	l = list(input().split())
	n = int(l[0])
	k = int(l[1])
	if k > n:
		q.append('NO')
	elif n % 2 != 0 and k % 2 == 0:
		q.append('NO')
	elif k == n:
		q.append('YES')
		q.append([1] * n)
	elif n % 2 != 0:
		q.append('YES')
		a = [1] * (k - 1)
		a.append(n - (k - 1))
		q.append(a)
	elif k <= n // 2:
		q.append('YES')
		a = [2] * (k - 1)
		a.append(n - 2 * (k - 1))
		q.append(a)
	elif k > n // 2 and k % 2 != 0:
		q.append('NO')
	else:
		q.append('YES')
		a = [1] * (k - 1)
		a.append(n - (k - 1))
		q.append(a)
i = 0
while i <= len(q) - 1:
	print(q[i])
	if q[i] == 'YES':
		i += 1
		for j in q[i]:
			print(j, end=' ')
		print()
		i += 1
	else:
		i += 1


def solve(n, k):
	if n - (k - 1) > 0 and (n - (k - 1)) % 2 == 1:
		print('YES')
		s = ''
		for i in range(k - 1):
			s += '1 '
		s += str(n - k + 1)
		print(s)
		return
	if n - (k - 1) * 2 > 0 and (n - (k - 1) * 2) % 2 == 0:
		print('YES')
		s = ''
		for i in range(k - 1):
			s += '2 '
		s += str(n - (k - 1) * 2)
		print(s)
		return
	print('NO')
t = int(input())
for j in range(t):
	(n, k) = map(int, input().split())
	solve(n, k)


import math
import bisect
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	l = []
	l1 = []
	summ = 0
	if n % 2 == 0 and k % 2 != 0:
		if n - 2 * (k - 1) > 0 and (n - 2 * (k - 1)) % 2 == 0:
			for i in range(k - 1):
				l.append(2)
				summ += 2
			l.append(n - summ)
			print('YES')
			print(*l)
		else:
			print('NO')
	elif n % 2 != 0 and k % 2 != 0:
		if n - (k - 1) > 0 and (n - (k - 1)) % 2 != 0:
			for i in range(k - 1):
				l.append(1)
				summ += 1
			l.append(n - summ)
			print('YES')
			print(*l)
		else:
			print('NO')
	elif n % 2 == 0 and k % 2 == 0:
		if n - (k - 1) > 0 and (n - (k - 1)) % 2 != 0:
			for i in range(k - 1):
				l.append(1)
				summ += 1
			l.append(n - summ)
			print('YES')
			print(*l)
		elif n - 2 * (k - 1) > 0 and (n - 2 * (k - 1)) % 2 == 0:
			for i in range(k - 1):
				l.append(2)
				summ += 2
			l.append(n - summ)
			print('YES')
			print(*l)
		else:
			print('NO')
	else:
		print('NO')


for _ in range(int(input())):
	l = []
	(n, k) = map(int, input().split())
	flag = 1
	if k > n:
		print('NO')
		continue
	elif n == k:
		while n > 0:
			l.append(1)
			n -= 1
	else:
		f = n
		if n % 2 == 0:
			k1 = k
			while k1 > 1:
				l.append(2)
				f -= 2
				k1 -= 1
			if f > 0:
				l.append(f)
				flag = 0
		if flag == 1:
			l = []
			f = n
			while k > 1:
				l.append(1)
				f -= 1
				k -= 1
			if f % 2 == 0:
				print('NO')
				continue
			l.append(f)
	print('YES')
	print(*l)


def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
entries = inp()
for i in range(entries):
	ins = inlt()
	n = ins[0]
	k = ins[1]
	if n < k:
		print('NO')
	elif n % 2 == 0:
		if n == k:
			print('YES')
			res = ''
			for z in range(k):
				res += str(1) + ' '
			print(res)
		elif n < 2 * k:
			if k % 2 == 1:
				print('NO')
			else:
				print('YES')
				res = ''
				for z in range(k - 1):
					res += str(1) + ' '
				res += str(n - (k - 1))
				print(res)
		else:
			print('YES')
			res = ''
			tmp = n
			for z in range(k - 1):
				res += str(2) + ' '
			res += str(n - 2 * (k - 1))
			print(res)
	elif n % 2 == 1:
		if k % 2 == 0:
			print('NO')
		else:
			print('YES')
			res = ''
			for z in range(k - 1):
				res += str(1) + ' '
			res += str(n - k + 1)
			print(res)


for T in range(int(input())):
	(n, k) = list(map(int, input().split()))
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
	elif n % 2 == 0 and k % 2 == 0:
		if k > n:
			print('NO')
		else:
			st = 1
			f = n - (k - 1) * 1
			print('YES')
			for i in range(k - 1):
				print(1, end=' ')
			print(f)
	elif n % 2 == 0 and k % 2 == 1:
		if n // k < 2:
			print('NO')
		else:
			f = n - (k - 1) * 2
			print('YES')
			for i in range(k - 1):
				print(2, end=' ')
			print(f)
	elif n % 2 == 1:
		if k > n:
			print('NO')
		else:
			f = n - (k - 1) * 1
			print('YES')
			for i in range(k - 1):
				print(1, end=' ')
			print(f)


t = int(input())
while t:
	[n, k] = [int(x) for x in input().split()]
	if n - 2 * (k - 1) > 0 and (n - 2 * (k - 1)) % 2 == 0:
		print('yes')
		ans = ''
		for i in range(k - 1):
			ans += '2 '
		ans += str(n - 2 * k + 2)
		print(ans)
	elif n - (k - 1) > 0 and (n - (k - 1)) % 2 != 0:
		print('yes')
		ans = ''
		for i in range(k - 1):
			ans += '1 '
		ans += str(n - k + 1)
		print(ans)
	else:
		print('no')
	t -= 1


for _ in range(int(input())):
	(N, K) = map(int, input().split())
	if K == 1:
		print('YES')
		print(N)
		continue
	if N % 2 != 0 and K % 2 == 0 or K > N or (N > K and N - K == 1):
		print('NO')
		continue
	if N % K == 0:
		print('YES')
		for i in range(K):
			print(N // K, end=' ')
		print()
	else:
		x = N - (K - 1)
		if x % 2 != 0:
			print('YES')
			for i in range(K - 1):
				print(1, end=' ')
			print(x)
		else:
			x = N - 2 * (K - 1)
			if x > 0 and x % 2 == 0:
				print('YES')
				for i in range(K - 1):
					print(2, end=' ')
				print(x)
			else:
				print('NO')


t = int(input())
ans = [[] for i in range(t)]
for i in range(t):
	(n, k) = [int(i) for i in input().split()]
	if n % 2 == 0:
		if k % 2 == 0 and n >= k:
			for j in range(k):
				ans[i].append(1)
			ans[i][0] += n - k
		elif n >= 2 * k:
			for j in range(k):
				ans[i].append(2)
			ans[i][0] += n - 2 * k
	elif n % 2 != 0 and (not (k % 2 == 0 or n < k)):
		for j in range(k):
			ans[i].append(1)
		ans[i][0] += n - k
for i in ans:
	if i == []:
		print('NO')
	else:
		print('YES')
		print(*i)


def driver():
	t = int(input())
	l = []
	for i in range(t):
		solution()

def solution():
	(n, k) = [int(i) for i in input().split()]
	for i in range(1, 3):
		s = n - i * (k - 1)
		st = (str(i) + ' ') * (k - 1)
		if s > 0:
			if s & 1 and i & 1:
				print('YES')
				print(s, st)
				return
			elif not s & 1 and (not i & 1):
				print('YES')
				print(s, st)
				return
		elif s <= 0:
			print('NO')
			return
		else:
			continue
	else:
		print('NO')
driver()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = [1 for _ in range(k - 1)]
	c = 0
	fuck = sum(a)
	if n - fuck > 0 and (n - fuck) % 2 == 1:
		c = 1
		print('YES')
		a.append(n - fuck)
		for i in a:
			print(i, end=' ')
		print()
	else:
		b = [2 for _ in range(k - 1)]
		duck = sum(b)
		if n - duck > 0 and (n - duck) % 2 == 0:
			c = 1
			b.append(n - duck)
			print('YES')
			for i in b:
				print(i, end=' ')
			print()
	if c == 0:
		print('NO')


def solve():
	(n, k) = [int(x) for x in input().split()]
	if int(n // k) == n / k:
		print('YES')
		li = [int(n // k)] * k
		print(*li)
		return
	else:
		x = 2 * (k - 1)
		if (n - x - 2) % 2 == 0 and n - x > 0:
			print('YES')
			li = [2] * (k - 1) + [n - x]
			print(*li)
			return
		x = 1 * (k - 1)
		if (n - x - 1) % 2 == 0 and n - x > 0:
			print('YES')
			li = [1] * (k - 1) + [n - x]
			print(*li)
			return
		print('NO')
t = int(input())
for i in range(t):
	solve()


import sys
read = sys.stdin.read
from math import log10, floor

def main():
	a = int(input())
	for _ in range(a):
		(n, k) = map(int, input().split())
		if n < k:
			print('NO')
		elif n == k:
			print('YES')
			r = [n // k] * k
			print(*r, sep=' ')
		else:
			p = n / 2
			if p % 1 == 0 and p >= k:
				print('YES')
				print(int((p - k + 1) * 2), end=' ')
				r = [2] * (k - 1)
				print(*r, sep=' ')
			else:
				p = (n - k) / 2
				if p % 1 == 0:
					print('YES')
					print(int(p * 2 + 1), end=' ')
					r = [1] * (k - 1)
					print(*r, sep=' ')
				else:
					print('NO')
main()


t = int(input())
for _ in range(t):
	(n, k) = [int(x) for x in input().split()]
	odd = 0
	odd = n - (k - 1)
	even = n - 2 * (k - 1)
	if odd > 0 and odd & 1:
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(odd)
	elif even > 0 and even % 2 == 0:
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		print(even)
	else:
		print('NO')


for j in range(int(input())):
	(n, k) = map(int, input().split())
	l = [int(n / k)] * k
	summ = int(n / k) * k
	if k > n:
		print('NO')
	elif summ == n:
		print('YES')
		for i in l:
			print(i, end=' ')
		print()
	else:
		l[0] = l[0] + n - summ
		if l[0] % 2 == l[1] % 2:
			print('YES')
			for i in l:
				print(i, end=' ')
			print()
		elif (l[0] + k - 1) % 2 == (l[1] - 1) % 2 and l[1] - 1 > 0:
			print('YES')
			print(l[0] + k - 1, end=' ')
			for i in range(1, len(l)):
				print(l[i] - 1, end=' ')
			print()
		else:
			print('NO')


t = int(input())
cases = []
for i in range(t):
	nk = list(map(int, input().split(' ')))
	cases.append(nk)

def solve(n, k):
	ans = []
	if k > n:
		return [0]
	elif (n - (k - 1)) % 2 == 1 and n - (k - 1) > 0:
		ans = [1 for i in range(k - 1)]
		ans.append(n - (k - 1))
		return ans
	elif (n - (k - 1) * 2) % 2 == 0 and n - (k - 1) * 2 > 0:
		ans = [2 for i in range(k - 1)]
		ans.append(n - (k - 1) * 2)
		return ans
	elif k == n:
		ans = [1 for i in range(k)]
		return ans
	elif k == 2 * n:
		ans = [2 for i in range(k)]
		return ans
	else:
		return [0]
for case in cases:
	ans = solve(case[0], case[1])
	if ans != [0]:
		print('YES')
		print(' '.join(list(map(str, ans))))
	else:
		print('NO')


m = int(input())
for i in range(m):
	(n, k) = map(int, input().split())
	if k > n or (n % 2 == 1 and k % 2 == 0):
		print('NO')
	else:
		answer = []
		if n % 2 == 0 and k % 2 == 0:
			for j in range(k - 1):
				answer.append(1)
		elif n % 2 == 0 and k % 2 == 1:
			for j in range(k - 1):
				answer.append(2)
		else:
			for j in range(k - 1):
				answer.append(1)
		if n - sum(answer) < 1:
			print('NO')
		else:
			answer.append(n - sum(answer))
			print('YES')
			print(*answer)


for tc in range(int(input())):
	(n, k) = [int(x) for x in input().split()]
	if n % 2 == 1:
		if k % 2 == 0:
			print('NO')
			continue
		n -= k - 1
		if n < 1:
			print('NO')
			continue
		print('YES')
		for i in range(k - 1):
			print(1)
		print(n)
	elif k % 2 == 0:
		n -= k - 1
		if n < 1:
			print('NO')
			continue
		print('YES')
		for i in range(k - 1):
			print(1)
		print(n)
	else:
		n -= 2 * (k - 1)
		if n < 1:
			print('NO')
			continue
		print('YES')
		for i in range(k - 1):
			print(2)
		print(n)


def func(A, B):
	ans = ''
	if A % 2 != 0 and B % 2 == 0:
		return 'No'
	elif A % 2 == 0 and B % 2 != 0:
		while B != 1:
			ans += '2 '
			A = A - 2
			B -= 1
			if A == 0:
				return 'No'
		ans += str(A)
		return ans
	elif A % 2 == 0 and B % 2 == 0:
		while B != 1:
			ans += '1 '
			A = A - 1
			B -= 1
			if A == 0:
				return 'No'
		ans += str(A)
		return ans
	elif A % 2 != 0 and B % 2 != 0:
		while B != 1:
			ans += '1 '
			A = A - 1
			B -= 1
			if A == 0:
				return 'No'
		ans += str(A)
		return ans
x = int(input())
a = []
for _ in range(x):
	a.append(list(map(int, input().split())))
for i in a:
	ans = func(i[0], i[1])
	if ans == 'No':
		print(ans)
	else:
		print('Yes')
		print(ans)


test_cases = int(input())
for _ in range(test_cases):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
		continue
	if n % 2 != 0 and k % 2 == 0:
		print('NO')
		continue
	if n % 2 == 0 and k % 2 != 0 and (n / k < 2):
		print('NO')
		continue
	print('YES')
	result = list()
	if n % 2 != 0:
		result = [1] * (k - 1)
		result.append(n - sum(result))
	else:
		result = [2] * (k - 1)
		if n - sum(result) <= 0:
			result = [1] * (k - 1)
		result.append(n - sum(result))
	print(' '.join([str(r) for r in result]))


t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	if n < k:
		print('NO')
		continue
	if (n - k + 1) % 2 != 0 and n - k + 1 > 0:
		print('Yes')
		for i in range(k - 1):
			print(1, end=' ')
		print(n - k + 1)
	elif (n - (k - 1) * 2) % 2 == 0 and n - (k - 1) * 2 > 0:
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		print(n - (k - 1) * 2)
	else:
		print('NO')


from math import floor

def solve(n, k):
	if n < k:
		return []
	last = n - (k - 1)
	if last >= 1 and last % 2 == 1:
		res = [1] * (k - 1)
		res.append(n - (k - 1))
		return res
	last = n - 2 * (k - 1)
	if last >= 2 and last % 2 == 0:
		res = [2] * (k - 1)
		res.append(last)
		return res
	return []
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	res = solve(n, k)
	if res:
		print('YES')
		print(' '.join(map(str, res)))
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
		continue
	arr = [1] * (k - 1)
	m = n - (k - 1)
	if m & 1:
		arr.append(m)
		print('YES')
		print(*arr)
		continue
	if 2 * k > n:
		print('NO')
		continue
	arr = [2] * (k - 1)
	m = n - 2 * (k - 1)
	if not m & 1:
		arr.append(m)
		print('YES')
		print(*arr)
		continue
	print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	ans = k - 1
	f = 0
	if ans < n and (n - ans) % 2 == 1:
		print('YES')
		print('1 ' * (k - 1), end='')
		print(n - ans)
		f = 1
	elif f == 0:
		ans = 2 * (k - 1)
		if ans < n and (n - ans) % 2 == 0:
			print('YES')
			print('2 ' * (k - 1), end='')
			print(n - ans)
			f = 1
	if f == 0:
		print('NO')


import copy
t = int(input())
for T in range(t):
	(n, k) = map(int, input().split())
	ans = []
	if n % 2 == 1 and k % 2 == 0:
		pass
	if n % 2 == 1 and k % 2 == 1 or (n % 2 == 0 and k % 2 == 0):
		if k <= n:
			ans = [1] * (k - 1) + [n - (k - 1)]
	if n % 2 == 0 and k % 2 == 1:
		if k * 2 <= n:
			ans = [2] * (k - 1) + [n - 2 * (k - 1)]
	if len(ans) == 0:
		print('NO')
	else:
		print('YES')
		for i in ans:
			print(i, end=' ')
		print()


from collections import Counter
import itertools
from functools import lru_cache
import sys
import math

def helper():
	pass

def solve():
	(n, k) = map(int, input().split(' '))
	if k == 1:
		print('YES')
		print(n)
		return
	if n % 2 == 0:
		left = n
		if k % 2 == 0 and k <= n:
			print('YES')
			for i in range(k - 2):
				print('1', end=' ')
				left -= 1
			print(1, left - 1)
		elif k % 2 == 1 and n / 2 >= k:
			print('YES')
			for i in range(k - 1):
				print('2', end=' ')
				left -= 2
			print(left)
		else:
			print('NO')
	else:
		if k > n:
			print('NO')
			return
		left = n
		ans = []
		for i in range(k - 1):
			ans.append('1')
			left -= 1
		if left % 2 == 1:
			print('YES')
			print(' '.join(ans), left)
		else:
			print('NO')
t = int(input())
for _ in range(t):
	solve()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n % k == 0:
		z = n // k
		print('YES')
		for i in range(k):
			print(z, end=' ')
		print('')
	elif n < k:
		print('NO')
	else:
		lol = n - (k - 1)
		if lol % 2 != 0:
			print('YES')
			for i in range(k - 1):
				print(1, end=' ')
			print(lol)
		else:
			lol = n - (k - 1) * 2
			if lol % 2 == 0 and lol > 0:
				print('YES')
				for i in range(k - 1):
					print(2, end=' ')
				print(lol)
			else:
				print('NO')


import math
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
	elif n == k:
		print('YES')
		print('1 ' * (k - 1) + '1')
	elif k == 1:
		print('YES')
		print(n)
	elif n % 2 == 0 and k % 2 == 0:
		n = n - (k - 1)
		print('YES')
		print('1 ' * (k - 1) + str(n))
	elif n % 2 == 0 and k % 2 != 0:
		p = k - 1
		l = []
		c = 0
		while p > 0:
			l.append(2)
			n = n - 2
			if n == 0:
				c = 1
				break
			else:
				p = p - 1
		if c == 0:
			print('YES')
			l.append(n)
			print(*l)
		else:
			print('NO')
	elif n % 2 != 0 and k % 2 == 0:
		print('NO')
	elif n % 2 != 0 and k % 2 != 0:
		print('YES')
		n = n - (k - 1)
		print('1 ' * (k - 1) + str(n))


import bisect
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate

def lcm(a, b):
	return a * b // math.gcd(a, b)

def sort_dict(key_value):
	return sorted(key_value.items(), key=lambda kv: (kv[1], kv[0]))

def list_input():
	return list(map(int, input().split()))

def num_input():
	return map(int, input().split())

def string_list():
	return list(input())

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def binaryToDecimal(n):
	return int(n, 2)

def solve():
	(n, k) = num_input()
	if n < k:
		print('NO')
	elif n % 2 != 0 and k % 2 == 0:
		print('NO')
	elif n == k:
		print('YES')
		print('1 ' * n)
	elif n % k == 0:
		print('YES')
		for i in range(k):
			print(n // k, end=' ')
		print()
	elif n % 2 == 0 and k % 2 == 0 or (n % 2 != 0 and k % 2 != 0):
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(n - (k - 1))
	elif n > 2 * k:
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		print(n - 2 * (k - 1))
	else:
		print('NO')
t = int(input())
for _ in range(t):
	solve()


t = int(input())
for x in range(t):
	(n, k) = map(int, input().split())
	case1 = n - (k - 1) * 1
	case2 = n - (k - 1) * 2
	if case1 > 0 and case1 % 2 == 1:
		print('YES')
		for x in range(k - 1):
			print(1, end=' ')
		print(case1)
	elif case2 > 0 and case2 % 2 == 0:
		print('YES')
		for x in range(k - 1):
			print(2, end=' ')
		print(case2)
	else:
		print('NO')


t = int(input())
k = 0
for _ in range(t):
	(n, k) = map(int, input().split(' '))
	if k > n:
		print('NO')
		continue
	if n % 2 != 0 and k % 2 == 0:
		print('NO')
		continue
	ans = []
	if n % 2 == 0:
		if k % 2 == 0:
			ans = ans + [1] * (k - 1)
			ans.append(n - 1 * (k - 1))
		else:
			if k * 2 > n:
				print('NO')
				continue
			ans = ans + [2] * (k - 1)
			ans.append(n - 2 * (k - 1))
	else:
		ans = ans + [1] * (k - 1)
		ans.append(n - 1 * (k - 1))
	print('YES')
	for i in ans:
		print(i, ' ', end='')
	if k != t - 1:
		print()
	k += 1


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	if n - (k - 1) > 0 and (n - (k - 1)) % 2 == 1:
		print('Yes')
		ans = [1] * (k - 1) + [n - (k - 1)]
		print(*ans)
	elif n - 2 * (k - 1) > 0 and (n - 2 * (k - 1)) % 2 == 0:
		print('Yes')
		ans = [2] * (k - 1) + [n - 2 * (k - 1)]
		print(*ans)
	else:
		print('No')


def find(n, k):
	print('YES')
	ans = []
	count = n // k
	if n % 2 == 0 and k % 2 == 1:
		count = count // 2 * 2
	if n % 2 == 1 and k % 2 == 1:
		count = count - 1 if count % 2 == 0 else count
	if count == 0:
		count
	n -= k * count
	for r in range(k):
		ans.append(count)
	if n != 0:
		ans[-1] += n
	answer = ''
	for a in ans:
		answer += str(a) + ' '
	print(answer)
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
	elif n % 2 == 1:
		if k % 2 == 0:
			print('NO')
		else:
			find(n, k)
	elif k % 2 == 1:
		if k * 2 > n:
			print('NO')
		else:
			find(n, k)
	else:
		find(n, k)


t = int(input())

def fun(n, k):
	odd = [1 for i in range(k - 1)]
	if (n - k + 1) % 2 == 1:
		odd.append(n - k + 1)
	else:
		odd = []
	even = [2 for i in range(k - 1)]
	if (n - 2 * k + 2) % 2 == 0:
		even.append(int(n - 2 * k + 2))
	else:
		even = []
	if len(odd) == 0 and len(even) == 0:
		print('NO')
	else:
		flo = 0
		fle = 0
		if len(even) == 0:
			for i in odd:
				if i <= 0:
					flo += 1
					break
			if flo:
				print('NO')
			else:
				print('YES')
				print(*odd, sep=' ')
		elif len(odd) == 0:
			for i in even:
				if i <= 0:
					fle += 1
					break
			if fle:
				print('NO')
			else:
				print('YES')
				print(*even, sep=' ')
		else:
			flo = 0
			fle = 0
			for i in even:
				if i <= 0:
					fle += 1
					break
			for i in odd:
				if i <= 0:
					flo += 1
					break
			if fle == 1 and flo == 1:
				print('NO')
			elif flo:
				print('YES')
				print(*even, sep=' ')
			else:
				print('YES')
				print(*odd, sep=' ')
while t:
	t -= 1
	(n, k) = map(int, input().split())
	fun(n, k)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if k > n or (n & 1 and k & 1 ^ 1) or (n & 1 ^ 1 and k & 1 and (k > n // 2)):
		print('NO')
		continue
	print('YES')
	if n & 1 or (n & 1 ^ 1 and k & 1 ^ 1):
		for i in range(k - 1):
			print(1, end=' ')
		else:
			print(n - k + 1)
	else:
		for i in range(k - 1):
			print(2, end=' ')
		else:
			print(n - (k - 1) * 2)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	li = []
	if n % 2 == 0:
		if k % 2 == 0:
			li.extend([1 for i in range(k - 1)])
			val = n - (k - 1)
			if val < 1:
				print('NO')
			else:
				li.append(val)
				print('YES')
				print(*li)
		else:
			li.extend([2 for i in range(k - 1)])
			val = n - 2 * (k - 1)
			if val < 2:
				print('NO')
			else:
				li.append(val)
				print('YES')
				print(*li)
	elif k % 2 == 0:
		print('NO')
	else:
		li.extend([1 for i in range(k - 1)])
		val = n - (k - 1)
		if val < 1:
			print('NO')
		else:
			li.append(val)
			print('YES')
			print(*li)


def isvalid(l):
	par = l[0] % 2
	for i in l:
		if i % 2 != par:
			return 0
		if i <= 0:
			return 0
	return 1
t = int(input())
for you in range(t):
	l = input().split()
	n = int(l[0])
	k = int(l[1])
	case1 = [1 for i in range(k - 1)]
	case1.append(n - k + 1)
	case2 = [2 for i in range(k - 1)]
	case2.append(n - 2 * k + 2)
	if isvalid(case1):
		print('YES')
		for i in case1:
			print(i, end=' ')
		print()
	elif isvalid(case2):
		print('YES')
		for i in case2:
			print(i, end=' ')
		print()
	else:
		print('NO')


t = int(input())
while t > 0:
	t -= 1
	(n, k) = [int(i) for i in input().split()]
	if n % 2 == 0:
		if k % 2 == 0 and n / k >= 1:
			s = 0
			print('YES')
			while k > 0:
				if not k == 1:
					print(1, end=' ')
					s += 1
				else:
					print(n - s)
				k -= 1
		elif k % 2 == 1 and n / k >= 2:
			s = 0
			print('YES')
			while k > 0:
				if not k == 1:
					print(2, end=' ')
					s += 2
				else:
					print(n - s)
				k -= 1
		else:
			print('NO')
	elif n % 2 == 1 and k % 2 == 1 and (n / k >= 1):
		s = 0
		print('YES')
		while k > 0:
			if not k == 1:
				print(1, end=' ')
				s += 1
			else:
				print(n - s)
			k -= 1
	else:
		print('NO')


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(INT()):
	(N, K) = MAP()
	if N % 2 == 0 and K % 2 == 1:
		if N < K * 2:
			NO()
			continue
		ans = [2] * K
		ans[0] += N - K * 2
	elif N % 2 == 1 and K % 2 == 0:
		NO()
		continue
	else:
		if N < K:
			NO()
			continue
		ans = [1] * K
		ans[0] += N - K
	YES()
	print(*ans)


t = int(input())
while t > 0:
	(n, k) = map(int, input().split())
	if (n - k + 1) % 2 != 0:
		if n - k + 1 <= 0:
			print('NO')
		else:
			print('YES')
			l = [1] * (k - 1) + [n - k + 1]
			print(*l)
	elif (n - (k - 1) * 2) % 2 == 0:
		if n - (k - 1) * 2 <= 0:
			print('NO')
		else:
			print('YES')
			l = [2] * (k - 1) + [n - (k - 1) * 2]
			print(*l)
	else:
		print('NO')
	t -= 1


for pi in range(int(input())):
	(n, k) = map(int, input().split())
	odd = [1] * (k - 1)
	eve = [2] * (k - 1)
	if (n - sum(odd)) % 2 != 0 and n - sum(odd) > 0:
		odd += [n - sum(odd)]
		print('YES')
		print(*odd)
		continue
	if (n - sum(eve)) % 2 == 0 and n - sum(eve) > 0:
		eve += [n - sum(eve)]
		print('YES')
		print(*eve)
		continue
	print('NO')


tt = int(input())
while tt:
	(n, k) = [int(x) for x in input().split()]
	if n < k:
		print('NO')
	elif n % 2 != 0 and k % 2 == 0:
		print('NO')
	elif n % 2 != 0 and k % 2 != 0:
		ans = ''
		for i in range(0, k - 1):
			ans += '1 '
		ans += str(n - k + 1)
		print('YES')
		print(ans)
	elif n % 2 == 0:
		if k % 2 == 0:
			ans = ''
			for i in range(0, k - 1):
				ans += '1 '
			ans += str(n - k + 1)
			print('YES')
			print(ans)
		elif n < 2 * k:
			print('NO')
		else:
			ans = ''
			for i in range(0, k - 1):
				ans += '2 '
			ans += str(n - 2 * (k - 1))
			print('YES')
			print(ans)
	tt -= 1


t = int(input())
for i in range(t):
	(n, k) = input().split()
	(n, k) = (int(n), int(k))
	if k == 1:
		print('YES')
		print(n)
	elif n % 2 == k % 2:
		if n - k + 1 <= 0:
			print('NO')
		else:
			print('YES')
			e = ['1'] * (k - 1)
			e.append(str(n - k + 1))
			print(' '.join(e))
	elif n % 2 == 0 and n >= 2 * k:
		if n - 2 * (k - 1) <= 0:
			print('NO')
		else:
			print('YES')
			e = ['2'] * (k - 1)
			e.append(str(n - 2 * (k - 1)))
			print(' '.join(e))
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	avail = True
	if n < k:
		avail = False
	elif k % 2 == 0:
		if n % 2 == 1:
			avail = False
	elif n % 2 == 0 and n < k * 2:
		avail = False
	if not avail:
		print('NO')
	else:
		print('YES')
		x = k - 1
		if n % 2 == 0 and k % 2 == 1:
			for i in range(x):
				print(2, end=' ')
			print(n - 2 * x)
		else:
			for i in range(x):
				print(1, end=' ')
			print(n - x)


tc = int(input())
while tc > 0:
	tc -= 1
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	a_t = a % 2
	b_t = b % 2
	if a_t and (not b_t):
		print('NO')
	elif a_t and b_t:
		if b > a:
			print('NO')
		else:
			print('YES')
			print('1 ' * (b - 1) + str(a - (b - 1)))
	elif b_t:
		if 2 * b > a:
			print('NO')
		else:
			print('YES')
			print('2 ' * (b - 1) + str(a - 2 * (b - 1)))
	elif b > a:
		print('NO')
	else:
		print('YES')
		print('1 ' * (b - 1) + str(a - (b - 1)))


t = int(input())
for _ in range(t):
	(n, k) = [int(i) for i in input().split()]
	if k > n:
		print('NO')
	else:
		avail = k - 1
		if n % 2 == 0:
			if avail % 2 == 0:
				if n - 2 * avail > 0:
					print('YES')
					for i in range(avail):
						print(2, end=' ')
					print(n - 2 * avail)
				else:
					print('NO')
			elif n - avail > 0:
				print('YES')
				for i in range(avail):
					print(1, end=' ')
				print(n - avail)
			else:
				print('NO')
		elif avail % 2 == 0:
			if n - avail > 0:
				print('YES')
				for i in range(avail):
					print(1, end=' ')
				print(n - avail)
			else:
				print('NO')
		else:
			print('NO')


def solve(n, k):
	if n & 1 == k & 1:
		if k > n:
			print('NO')
			return
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(n - (k - 1))
	else:
		if n & 1 == 1:
			print('NO')
			return
		if 2 * k > n:
			print('NO')
			return
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		print(n - 2 * (k - 1))
try:
	for _ in range(int(input())):
		(n, k) = map(int, input().split())
		solve(n, k)
except Exception as e:
	print(e)
	pass


from math import ceil, floor
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	ans1 = []
	ans2 = []
	flag = 0
	flag2 = 0
	if n & 1 == 1:
		flag = 1
	ans1 = [1] * (k - 1)
	val1 = n - 1 * (k - 1)
	ans2 = [2] * (k - 1)
	val2 = n - 2 * (k - 1)
	if val1 > 0 and val1 & 1 == 1:
		flag2 = 1
		ans1.append(val1)
		if sum(ans1) == n:
			print('YES')
			print(*ans1)
			continue
	if val2 > 0 and val2 & 1 == 0:
		flag2 = 1
		ans2.append(val2)
		if sum(ans2) == n:
			print('YES')
			print(*ans2)
			continue
	if flag2 == 0:
		print('NO')
		continue


import sys
t = int(sys.stdin.readline().strip())
for _ in range(t):
	(n, k) = list(map(int, sys.stdin.readline().strip().split()))
	summands = []
	if n == k:
		print('YES')
		print(' '.join(['1' for _ in range(n)]))
	elif n % 2 == 0:
		ncopy = n
		for _ in range(k - 1):
			summands.append(2)
			ncopy -= 2
		if ncopy <= 0 or n % 2 == 1:
			summands = []
			for _ in range(k - 1):
				summands.append(1)
				n -= 1
			if n <= 0 or n % 2 == 0:
				print('NO')
			else:
				print('YES')
				summands.append(n)
				print(' '.join([str(x) for x in summands]))
		else:
			print('YES')
			summands.append(ncopy)
			print(' '.join([str(x) for x in summands]))
	elif k % 2 == 0:
		print('NO')
	else:
		for _ in range(k - 1):
			summands.append(1)
			n -= 1
		if n <= 0 or n % 2 == 0:
			print('NO')
		else:
			print('YES')
			summands.append(n)
			print(' '.join([str(x) for x in summands]))


def main():
	for _ in range(int(input())):
		(n, k) = map(int, input().split())
		nc = 1 * (k - 1) + (n - 1 * (k - 1))
		c = 2 * (k - 1) + (n - 2 * (k - 1))
		if nc == n and n - 1 * (k - 1) > 0 and (n - 1 * (k - 1)) % 2:
			print('YES')
			print('1 ' * (k - 1) + str(n - 1 * (k - 1)))
		elif c == n and n - 2 * (k - 1) > 0 and ((n - 2 * (k - 1)) % 2 == 0):
			print('YES')
			print('2 ' * (k - 1) + str(n - 2 * (k - 1)))
		else:
			print('NO')
main()


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	x = []
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
	elif k == 1:
		print('YES')
		print(n)
	elif n < k:
		print('NO')
	elif n % 2 == 0 and k % 2 == 1:
		x = [2]
		for i in range(k - 1):
			if i == k - 2:
				x.append(n - sum(x))
			else:
				x.append(2)
		y = 1
		z = x[0] % 2
		for i in range(1, k):
			if x[i] % 2 == z and x[i] > 0:
				y += 1
		if y == k:
			print('YES')
			print(' '.join((str(i) for i in x)))
		else:
			print('NO')
	else:
		x = [1]
		for i in range(k - 1):
			if i == k - 2:
				x.append(n - sum(x))
			else:
				x.append(1)
		y = 1
		z = x[0] % 2
		for i in range(1, k):
			if x[i] % 2 == z and x[i] > 0:
				y += 1
		if y == k:
			print('YES')
			print(' '.join((str(i) for i in x)))
		else:
			print('NO')


ncases = int(input())
n = 0
k = 0
for x in range(0, ncases):
	(n, k) = tuple([int(x) for x in input().split()])
	if k == 1:
		print('YES')
		print(n)
	elif n % 2 == 0:
		if n >= 2 * k:
			print('YES')
			print(str(n - 2 * (k - 1)) + ' ' + '2 ' * (k - 2) + '2')
		elif k % 2 == 0 and k <= n:
			print('YES')
			print(str(n - k + 1) + ' ' + (k - 2) * '1 ' + '1')
		else:
			print('NO')
	elif k % 2 == 1 and n >= k:
		print('YES')
		print(str(n - k + 1) + ' ' + (k - 2) * '1 ' + '1')
	else:
		print('NO')


def soln(n, k):
	res = None
	s = 2 * (k - 1)
	result = [2] * (k - 1) + [n - s]
	if result[-1] <= 0 or result[-1] % 2 != 0:
		pass
	else:
		res = result
	s = 1 * (k - 1)
	result = [1] * (k - 1) + [n - s]
	if result[-1] <= 0 or result[-1] % 2 != 1:
		pass
	else:
		res = result
	return res

def main():
	t = int(input())
	for _ in range(t):
		(n, k) = [int(x) for x in input().split(' ')]
		result = soln(n, k)
		if result is None:
			print('NO')
			continue
		print('YES')
		print(' '.join((str(x) for x in result)))
main()


for _ in range(int(input())):
	(n, k) = [int(s) for s in input().split()]
	ans1 = n - (k - 1)
	if ans1 > 0 and ans1 % 2 == 1:
		print('YES')
		print(*[1] * (k - 1), ans1)
		continue
	ans2 = n - 2 * (k - 1)
	if ans2 > 0 and ans2 % 2 == 0:
		print('YES')
		print(*[2] * (k - 1), ans2)
		continue
	print('NO')


def is_odd(val):
	return val % 2 == 1

def is_even(val):
	return val % 2 == 0
for t in range(int(input())):
	(n, k) = map(int, input().split())
	answer = list()
	if is_odd(n) and is_even(k):
		pass
	elif is_odd(n) and is_odd(k) or (is_even(n) and is_even(k)):
		if n < k:
			pass
		else:
			answer.append(n - k + 1)
			answer.extend([1 for i in range(k - 1)])
	elif n < 2 * k:
		pass
	else:
		answer.append(n - 2 * (k - 1))
		answer.extend([2 for i in range(k - 1)])
	if answer:
		print('YES')
		print(' '.join(map(str, answer)))
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	va = n % 2
	va1 = k % 2
	var = k - 1
	l = []
	l1 = []
	rem = abs(n - (k - 1))
	re = abs(n - 2 * (k - 1))
	f = 1
	flag = 1
	if va != 0 and va1 == 0:
		f = 0
		flag = 0
		print('NO')
	if va == 0 and va1 != 0 and (flag == 1):
		if n < 2 * k:
			print('NO')
		else:
			l = [2] * var
			l.append(re)
			print('YES')
			print(*l)
	if va == 0 and va1 == 0 and (flag == 1):
		if n < k:
			print('NO')
		else:
			l1 = [1] * var
			l1.append(rem)
			print('YES')
			print(*l1)
	if va != 0 and va1 != 0 and (flag == 1):
		if n < k:
			print('NO')
		else:
			l1 = [1] * var
			l1.append(rem)
			print('YES')
			print(*l1)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().rstrip().split())
	l = []
	if k > n:
		print('NO')
		continue
	for _ in range(k - 1):
		l.append(1)
	if (n - sum(l)) % 2 == 1 and n - sum(l) > 0:
		print('YES')
		for num in l:
			print(num, end=' ')
		print(n - sum(l))
		continue
	l = []
	for _ in range(k - 1):
		l.append(2)
	if (n - sum(l)) % 2 == 0 and n - sum(l) > 0:
		print('YES')
		for num in l:
			print(num, end=' ')
		print(n - sum(l))
		continue
	print('NO')


import math
for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	if n < k:
		print('NO')
	elif n % 2 == 0:
		if k % 2 == 0:
			d = []
			for i in range(k - 1):
				d.append(1)
			d.append(n - k + 1)
			print('YES')
			print(*d)
		elif n < 2 * k:
			print('NO')
		else:
			d = []
			for i in range(k - 1):
				d.append(2)
			d.append(n - 2 * (k - 1))
			print('YES')
			print(*d)
	elif k % 2 == 1:
		d = []
		for i in range(k - 1):
			d.append(1)
		d.append(n - k + 1)
		print('YES')
		print(*d)
	else:
		print('NO')


caselist = []
cases = int(input())
for i in range(cases):
	(n, k) = input().split(' ')
	caselist.append((int(n), int(k)))
for nk in caselist:
	if nk[0] % 2 == 0:
		if nk[1] % 2 == 1:
			if nk[1] <= nk[0] / 2:
				print('YES')
				for x in range(nk[1] - 1):
					print('2 ', end='')
				print(str(nk[0] - 2 * (nk[1] - 1)))
			else:
				print('NO')
		elif nk[1] <= nk[0]:
			print('YES')
			for x in range(nk[1] - 1):
				print('1 ', end='')
			print(str(nk[0] - nk[1] + 1))
		else:
			print('NO')
	elif nk[1] % 2 == 0:
		print('NO')
	elif nk[1] <= nk[0]:
		print('YES')
		for x in range(nk[1] - 1):
			print('1 ', end='')
		print(str(nk[0] - nk[1] + 1))
	else:
		print('NO')


from sys import stdin, stdout
for testcases in range(int(stdin.readline())):
	(n, k) = map(int, stdin.readline().split())
	if n - k + 1 > 0 and (n - k + 1) % 2 == 1:
		print('YES')
		print('1 ' * (k - 1), n - k + 1)
	elif n - 2 * (k - 1) > 0 and (n - 2 * (k - 1)) % 2 == 0:
		print('YES')
		print('2 ' * (k - 1), n - 2 * (k - 1))
	else:
		print('NO')


from collections import Counter, defaultdict, deque
from operator import itemgetter
import math
import sys
input = sys.stdin.readline

def solve():
	(n, k) = [int(x) for x in input().split()]
	res = []
	if k > n:
		print('NO')
		return
	if n & 1 and (not k & 1):
		print('NO')
		return
	if n & 1 ^ 1 and k & 1:
		if k * 2 > n:
			print('NO')
			return
		while k - 1:
			res.append(2)
			n -= 2
			k -= 1
		print('YES')
		print(*res, n)
	else:
		while k - 1:
			n -= 1
			k -= 1
			res.append(1)
		print('YES')
		print(*res, n)
tt = int(input())
for test in range(tt):
	solve()


def sameParitySummands(n, k):
	a = []
	if n % 2 != 0:
		if k % 2 == 0 or n < k:
			return (False, [])
		a = [1] * k
		a[-1] += n - k
	elif n % 2 == 0:
		if k % 2 != 0:
			if n < 2 * k:
				return (False, [])
			a = [2] * k
			a[-1] += n - 2 * k
		else:
			if n < k:
				return (False, [])
			a = [1] * k
			a[-1] += n - k
	return (True, a)
t = int(input())
for case in range(t):
	(n, k) = map(int, input().split())
	(possible, a) = sameParitySummands(n, k)
	if possible:
		print('YES')
		print(' '.join(map(str, a)))
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	o1 = (k - 1) * 1
	o2 = n - o1
	e1 = (k - 1) * 2
	e2 = n - e1
	if 1 == o2 % 2 and o2 > 0:
		print('YES')
		print('1 ' * (k - 1), end='')
		print(o2)
	elif e2 % 2 == 0 and e2 > 0:
		print('YES')
		print('{}{}'.format('2 ' * (k - 1), n - e1))
	else:
		print('NO')


GI = lambda : int(input())
GIS = lambda : map(int, input().split())
LGIS = lambda : list(GIS())

def main():
	pass
	for t in range(GI()):
		(n, k) = GIS()
		last = n - k + 1
		if last <= 0 or last % 2 == 0:
			last = n - (k - 1) * 2
			if last <= 0 or last % 2 == 1:
				res = []
			else:
				res = [2] * (k - 1) + [last]
		else:
			res = [1] * (k - 1) + [last]
		if res:
			print('YES')
			print(' '.join(map(str, res)))
		else:
			print('NO')
main()


nn = int(input())
for _ in range(nn):
	(n, k) = input().split(' ')
	n = int(n)
	k = int(k)
	if k > n:
		print('NO')
	else:
		temp = n - (k - 1)
		if temp % 2 == 1:
			print('YES')
			for _ in range(k - 1):
				print(1, end=' ')
			print(temp)
		else:
			temp = n - (k - 1) * 2
			if temp > 1 and temp % 2 != 1:
				print('YES')
				for _ in range(k - 1):
					print(2, end=' ')
				print(temp)
			else:
				print('NO')


for _ in range(int(input())):
	(n, k) = [int(x) for x in input().split()]
	odd = [1] * (k - 1)
	t = n - (k - 1)
	if t > 0 and t & 1:
		odd.append(t)
		print('YES')
		print(' '.join(map(str, odd)))
		continue
	even = [2] * (k - 1)
	t = n - 2 * (k - 1)
	if t > 0 and (not t & 1):
		even.append(t)
		print('YES')
		print(' '.join(map(str, even)))
		continue
	print('NO')


def read_int():
	return int(input().strip())

def read_ints():
	return list(map(int, input().strip().split(' ')))

def solve():
	(n, k) = read_ints()
	if n - (k - 1) > 0 and (n - (k - 1)) % 2 == 1:
		print('YES')
		print(' '.join(map(str, [1] * (k - 1) + [n - (k - 1)])))
		return
	if n - (k - 1) * 2 > 0 and (n - (k - 1) * 2) % 2 == 0:
		print('YES')
		print(' '.join(map(str, [2] * (k - 1) + [n - (k - 1) * 2])))
		return
	print('NO')
T = read_int()
for _ in range(T):
	solve()


T = int(input())
AB = [list(map(int, input().split())) for i in range(T)]

def make_list(x, y):
	if y > x:
		return []
	elif (x - (y - 1)) % 2 == 1:
		L = [1 for j in range(y - 1)]
		return L + [x - (y - 1)]
	elif (x - 2 * y + 2) % 2 == 0 and x - 2 * y + 2 > 0:
		L = [2 for j in range(y - 1)]
		return L + [x - 2 * y + 2]
	else:
		return []
for i in range(T):
	ML = make_list(AB[i][0], AB[i][1])
	if ML == []:
		print('NO')
	else:
		print('YES')
		print(*ML)


def z(n, k, x):
	if k * x > n:
		print('NO')
		return
	else:
		l = []
		for _ in range(k - 1):
			l += [x]
		l += [n - x * k + x]
	print('YES')
	for x in l:
		print(x, end=' ')
	return
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if k % 2 == 0:
		if n % 2 == 0:
			z(n, k, 1)
		else:
			print('NO')
	elif n % 2 == 0:
		z(n, k, 2)
	else:
		z(n, k, 1)


for t in range(int(input())):
	(n, m) = map(int, input().split())
	if n < m or (m != 1 and n - m == 1) or (n & 1 and m % 2 == 0) or (n % 2 == 0 and m & 1 and (n <= 2 * (m - 1))):
		print('NO')
		continue
	print('YES')
	if n % 2 == 0 and m & 1:
		l = [2] * (m - 1)
		l.append(n - 2 * (m - 1))
		print(*l)
	else:
		l = [1] * (m - 1)
		l.append(n - m + 1)
		print(*l)


import sys
readline = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, k) = map(int, readline().split())
	if n & 1 == 1 and k & 1 == 0:
		print('NO')
		continue
	parity = 1 if n & 1 == k & 1 else 0
	if parity:
		if k > n:
			print('NO')
			continue
		ans = [1] * (k - 1) + [n - (k - 1)]
	else:
		if 2 * k > n:
			print('NO')
			continue
		ans = [2] * (k - 1) + [n - 2 * (k - 1)]
	print('YES')
	print(*ans)


def second(n, k):
	if n - (k - 1) > 0 and (n - (k - 1)) % 2:
		print('YES')
		print('1 ' * (k - 1), n - (k - 1), sep='')
	elif n - (k - 1) * 2 > 0 and (n - (k - 1) * 2) % 2 == 0:
		print('YES')
		print('2 ' * (k - 1), n - (k - 1) * 2, sep='')
	else:
		print('NO')
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	second(n, k)


T = input()
t = int(T)
i = 0
while i < t:
	try:
		N = input()
	except:
		break
	sk = N.split(' ')
	n = int(sk[0])
	k = int(sk[1])
	ls = list()
	if k > n or (n % 2 == 1 and k % 2 == 0):
		print('NO')
	elif n / k == 1 and n % 2 == 0 and (k % 2 == 1):
		print('NO')
	else:
		dv = n / k
		md = n % k
		if md % 2:
			j = 0
			while j < k:
				ls.append(int(n / k) - 1)
				j = j + 1
			if ls[0] == 0:
				print('NO')
				continue
			ls[0] = ls[0] + n - ls[0] * k
		else:
			j = 0
			while j < k:
				ls.append(int(n / k))
				j = j + 1
			ls[0] = ls[0] + md
		print('YES')
		print(*ls)
	i = i + 1


t = int(input())
while t != 0:
	t -= 1
	(n, k) = [int(x) for x in input().split()]
	if k > n:
		print('NO')
		continue
	if n % 2 == 0:
		if n - (k - 1) * 2 > 0:
			print('YES')
			print(*[2] * (k - 1) + [n - (k - 1) * 2])
		elif n - (k - 1) * 1 > 0 and (n - (k - 1) * 1) % 2 != 0:
			print('YES')
			print(*[1] * (k - 1) + [n - (k - 1) * 1])
		else:
			print('NO')
	elif k % 2 == 0:
		print('NO')
	elif n - (k - 1) * 1 > 0 and (n - (k - 1) * 1) % 2 != 0:
		print('YES')
		print(*[1] * (k - 1) + [n - (k - 1) * 1])
	else:
		print('NO')


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if n % 2 == 1 and m % 2 == 0:
		print('NO')
	elif n < m:
		print('NO')
	elif n % 2 == 0 and m % 2 == 1:
		if 2 * m > n:
			print('NO')
		else:
			print('YES')
			print(*['2' for i in range(m - 1)] + [str(n - 2 * (m - 1))])
	else:
		print('YES')
		a = ['1' for i in range(m - 1)] + [str(n - (m - 1))]
		print(*a)


count = int(input())
for i in range(count):
	numbers = input().split(' ')
	n = int(numbers[0])
	k = int(numbers[1])
	if k % 2 == 0:
		if n % 2 == 0:
			if k > n:
				print('NO')
			else:
				print('YES')
				for j in range(k - 1):
					print(1, end=' ')
				last = n - k + 1
				print(last)
		else:
			print('NO')
	elif n % 2 == 0:
		if k * 2 > n:
			print('NO')
		else:
			print('YES')
			for j in range(k - 1):
				print(2, end=' ')
			last = n - 2 * k + 2
			print(last)
	elif k > n:
		print('NO')
	else:
		print('YES')
		for j in range(k - 1):
			print(1, end=' ')
		last = n - k + 1
		print(last)


for _ in range(int(input())):
	(n, k) = list(map(int, input().split(' ')))
	if (n - k + 1) % 2 == 1 and n - k >= 0:
		ans = [1 for x in range(k - 1)]
		ans.append(n - k + 1)
		print('YES')
		print(*ans)
	elif n % 2 == 0 and n - 2 * k + 2 > 0:
		ans = [2 for x in range(k - 1)]
		ans.append(n - 2 * k + 2)
		print('YES')
		print(*ans)
	else:
		print('NO')


def main():
	(n, k) = map(int, input().split())
	ans1 = [1] * (k - 1)
	ans2 = [2] * (k - 1)
	ans1.append(n - sum(ans1))
	ans2.append(n - sum(ans2))
	if ans1[-1] % 2 != 0 and ans1[-1] > 0:
		print('YES')
		print(*ans1)
	elif ans2[-1] % 2 == 0 and ans2[-1] > 0:
		print('YES')
		print(*ans2)
	else:
		print('NO')
t = int(input())
for _ in range(t):
	main()


t = int(input())
for q in range(t):
	(n, k) = list(map(int, input().split(' ')))
	p = n // k
	if k <= n:
		if n % 2 != 0 and k % 2 != 0:
			print('YES')
			if k == 1:
				print(n)
			else:
				p = n - (k - 1)
				print(p, end=' ')
				for k in range(k - 1):
					print(1, end=' ')
				print()
		elif n % 2 == 0 and k % 2 != 0:
			if p % 2 != 0:
				p -= 1
			if p != 0:
				print('YES')
				while n > 0:
					if k == 1:
						print(n)
						n = 0
						k -= 1
					else:
						print(p, end=' ')
						n -= p
						k -= 1
			else:
				print('NO')
		elif n % 2 == 0 and k % 2 == 0:
			print('YES')
			while n > 0:
				if k == 1:
					print(n)
					n = 0
					k -= 1
				else:
					print(p, end=' ')
					n -= p
					k -= 1
		elif n % 2 != 0 and k % 2 == 0:
			print('NO')
	else:
		print('NO')


N = int(input())
for i in range(N):
	(A, B) = map(int, input().split())
	if B == 1:
		print('YES')
		print(A)
	elif A % 2 == B % 2 and A >= B:
		print('YES')
		ans = []
		for j in range(B - 1):
			ans.append(1)
		ans.append(A - B + 1)
		print(*ans)
	elif A % 2 == 0 and B % 2 == 1 and (A >= B * 2):
		print('YES')
		ans = []
		for j in range(B - 1):
			ans.append(2)
		ans.append(A - 2 * B + 2)
		print(*ans)
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	ans = []
	if k > n:
		print('NO')
		continue
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
		continue
	if n % 2 == 1:
		while k > 1:
			k -= 1
			ans.append(1)
		ans.append(n - len(ans))
	elif k % 2 == 0:
		while k > 1:
			k -= 1
			ans.append(1)
		ans.append(n - len(ans))
	elif n >= 2 * k:
		while k > 1:
			k -= 1
			ans.append(2)
		ans.append(n - len(ans) * 2)
	else:
		print('NO')
		continue
	print('YES')
	print(*ans)


from sys import stdin
inp = lambda : stdin.readline().strip()
t = int(inp())
for i in range(t):
	(n, k) = [int(x) for x in input().split()]
	if n % 2 != 0 and k % 2 == 0:
		print('NO')
		continue
	if n % 2 == 0:
		if k % 2 == 0:
			if n - 1 * (k - 1) <= 0:
				print('NO')
				continue
			print('YES')
			for i in range(k - 1):
				print('1', end=' ')
			print(n - 1 * (k - 1))
			continue
		if k % 2 != 0:
			if n - 2 * (k - 1) <= 0:
				print('NO')
				continue
			print('YES')
			for i in range(k - 1):
				print('2', end=' ')
			print(n - 2 * (k - 1))
			continue
	if n % 2 != 0:
		if n - 1 * (k - 1) <= 0:
			print('NO')
			continue
		print('YES')
		for i in range(k - 1):
			print('1', end=' ')
		print(n - 1 * (k - 1))
		continue


for x in range(int(input())):
	(total, split) = map(int, input().split())
	ok = 'YES'
	for x in range(1):
		ans = [2] * (split - 1) + [total - 2 * (split - 1)]
		if ans[-1] >= 1 and ans[-1] % 2 == 0:
			print('YES')
			print(' '.join(map(str, ans)))
			break
		ans = [1] * (split - 1) + [total - (split - 1)]
		if ans[-1] >= 1 and ans[-1] % 2 == 1:
			print('YES')
			print(' '.join(map(str, ans)))
			break
		else:
			print('NO')


import sys
from math import ceil
read = sys.stdin.buffer.readline
mi = lambda : map(int, read().split())
li = lambda : list(mi())
cin = lambda : int(read())
ans = 1
(la, lb) = (1, 1)
for _ in range(cin()):
	(n, k) = mi()
	if n < k:
		print('no')
	elif (n - k) % 2 == 0:
		print('yes')
		for i in range(k - 1):
			print(1, end=' ')
		print(1 + n - k)
	elif (n - 2 * k) % 2 == 0 and n >= 2 * k:
		print('yes')
		for i in range(k - 1):
			print(2, end=' ')
		print(2 + n - 2 * k)
	else:
		print('no')


def read_int():
	return int(input())

def read_ints():
	return map(int, input().split(' '))
t = read_int()
for case_num in range(t):
	(n, k) = read_ints()
	if n % 2 == 0 and k % 2 == 1:
		if n < 2 * k:
			print('NO')
		else:
			print('YES')
			ans = [2 if i > 0 else n - (k - 1) * 2 for i in range(k)]
			print(' '.join(map(str, ans)))
	elif n % 2 == 1 and k % 2 == 0 or n < k:
		print('NO')
	else:
		print('YES')
		ans = [1 if i > 0 else n - k + 1 for i in range(k)]
		print(' '.join(map(str, ans)))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	possible = False
	ans = []
	rest1 = n - (k - 1)
	rest2 = n - 2 * (k - 1)
	if rest2 % 2 == 0 and rest2 > 1:
		for i in range(k - 1):
			ans.append(2)
		ans.append(rest2)
		possible = True
	elif rest1 % 2 > 0 and rest1 > 0:
		for i in range(k - 1):
			ans.append(1)
		ans.append(rest1)
		possible = True
	if possible:
		print('YES')
		print(*ans)
	else:
		print('NO')


c = int(input())
for i in range(c):
	(a, b) = [int(f) for f in input().split()]
	if a % 2 == 1 and b % 2 == 0:
		print('NO')
	else:
		ans = []
		if a % 2 == 0 and b % 2 == 1:
			for i in range(b - 1):
				ans.append(2)
				a -= 2
			ans.append(a)
		else:
			for i in range(b - 1):
				ans.append(1)
				a -= 1
			ans.append(a)
		if ans[-1] <= 0:
			print('NO')
		else:
			print('YES')
			print(' '.join((str(d) for d in ans)))


a = int(input())
for i in range(0, a):
	(n, k) = map(int, input().split())
	sol = []
	if n % 2 == 0:
		if k * 2 > n:
			if k % 2 == 0:
				if k > n:
					print('NO')
				else:
					for i in range(0, k - 1):
						sol.append(1)
					sol.append(n - k + 1)
			else:
				print('NO')
		else:
			for i in range(0, k - 1):
				sol.append(2)
			sol.append(n - (k - 1) * 2)
	elif k > n:
		print('NO')
	elif k % 2 == 0:
		print('NO')
	else:
		for i in range(0, k - 1):
			sol.append(1)
		sol.append(n - k + 1)
	if len(sol) > 0:
		print('YES')
		print(' '.join(list(map(str, sol))))


t = int(input())
for trying in range(t):
	(n, k) = list(map(int, input().split()))
	if n % 2 == k % 2 and k <= n:
		print('YES')
		print(' '.join(list('1' * (k - 1)) + [str(n - k + 1)]))
	elif n % 2 == 0 and k * 2 <= n:
		print('YES')
		print(' '.join(list('2' * (k - 1)) + [str(n - 2 * (k - 1))]))
	else:
		print('NO')


n = int(input(''))
for i in range(n):
	tmp = map(int, input().split())
	tmp = list(tmp)
	if tmp[1] > tmp[0]:
		print('NO')
	elif (tmp[0] - (tmp[1] - 1)) % 2 == 1 and tmp[0] - (tmp[1] - 1) > 0:
		print('YES')
		for j in range(tmp[1] - 1):
			print(1, end=' ')
		print(tmp[0] - tmp[1] + 1)
	elif (tmp[0] - (tmp[1] - 1) * 2) % 2 == 0 and tmp[0] - (tmp[1] - 1) * 2 > 0:
		print('YES')
		for j in range(tmp[1] - 1):
			print(2, end=' ')
		print(tmp[0] - (tmp[1] - 1) * 2)
	else:
		print('NO')


n = int(input())

def get_answer(a, b):
	if (a - 1 * (b - 1)) % 2 == 1 and a - 1 * (b - 1) > 0:
		return ('YES', ['1'] * (b - 1) + [str(a - b + 1)])
	elif (a - 2 * (b - 1)) % 2 == 0 and a - 2 * (b - 1) > 0:
		return ('YES', ['2'] * (b - 1) + [str(a - 2 * (b - 1))])
	else:
		return ('NO', [])
for _ in range(n):
	v = input().split()
	a = int(v[0])
	b = int(v[1])
	(c, d) = get_answer(a, b)
	print(c)
	if c == 'YES':
		print(' '.join(d))


from math import ceil

def run():
	t = int(input())
	for i in range(t):
		(n, k) = map(int, input().split())
		n1 = n - (k - 1)
		n2 = n - 2 * (k - 1)
		ans = []
		if n1 > 0 and n1 % 2:
			ans = [1 for i in range(k - 1)]
			ans.append(n1)
		elif n2 > 0 and (not n2 % 2):
			ans = [2 for i in range(k - 1)]
			ans.append(n2)
		if len(ans):
			print('YES')
			print(*ans)
		else:
			print('NO')
run()


def parity(n, k):
	if n < k:
		print('NO')
		return
	if (n - k) // 2 == (n - k) / 2:
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(n - k + 1)
		return
	elif n // 2 == n / 2 and n / 2 >= k:
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		print(n - 2 * (k - 1))
		return
	else:
		print('NO')
		return
t = int(input())
array = []
for i in range(t):
	array.append(list(map(int, input().split(' '))))
for x in array:
	parity(*x)


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
import sys
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	if n % 2 == 1:
		if k % 2 != 1:
			print('NO')
		elif k > n:
			print('NO')
		else:
			sys.stdout.write('YES\n')
			for i in range(k - 1):
				sys.stdout.write(str(1) + ' ')
			sys.stdout.write(str(n - k + 1) + '\n')
	elif k % 2 == 0:
		if k > n:
			print('NO')
		else:
			sys.stdout.write('YES\n')
			for i in range(k - 1):
				sys.stdout.write(str(1) + ' ')
			sys.stdout.write(str(n - k + 1) + '\n')
	elif 2 * k > n:
		print('NO')
	else:
		sys.stdout.write('YES\n')
		for i in range(k - 1):
			sys.stdout.write(str(2) + ' ')
		sys.stdout.write(str(n - 2 * (k - 1)) + '\n')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	n2 = n
	i = 0
	l = []
	while i < k - 1:
		l.append(1)
		n2 = n2 - 1
		i += 1
	if n2 % 2 == 1 and n2 > 0:
		print('YES')
		for i in l:
			print(i, end=' ')
		print(n2)
	else:
		i = 0
		l = []
		while i < k - 1:
			l.append(2)
			n = n - 2
			i += 1
		if n % 2 == 0 and n > 0:
			print('YES')
			for i in l:
				print(i, end=' ')
			print(n)
		else:
			print('NO')


t = 1
t = int(input())

def solve():
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
	elif n % 2 == 1 and k % 2 == 0:
		print('NO')
	elif (n % 2 == 0 and k % 2 == 1) and 2 * k > n:
		print('NO')
	else:
		print('YES')
		tr = n
		l = []
		m = 1
		if n % 2 == 0 and k % 2 == 1:
			m = 2
		for i in range(k - 1):
			l.append(m)
			tr -= m
		l.append(tr)
		ans = ' '.join([str(v) for v in l])
		print(ans)
for xx in range(t):
	solve()


T = int(input())
for t in range(T):
	(n, k) = list(map(int, input().split()))
	if n % 2 and k % 2 == 0:
		print('NO')
		continue
	if k > n:
		print('NO')
		continue
	temp = int(n / k)
	if n % 2 == 0 and k % 2 == 0:
		if temp == 0:
			print('NO')
			continue
		ans = [str(temp)] * (k - 1)
		ans.append(str(n - temp * (k - 1)))
	elif n % 2 == 0 and k % 2 != 0:
		if temp % 2 != 0:
			temp -= 1
		if temp == 0:
			print('NO')
			continue
		ans = [str(temp)] * (k - 1)
		ans.append(str(n - temp * (k - 1)))
	elif n % 2 == 1:
		if temp % 2 == 0:
			temp -= 1
		if temp == 0:
			print('NO')
			continue
		ans = [str(temp)] * (k - 1)
		ans.append(str(n - temp * (k - 1)))
	print('YES')
	print(' '.join(ans))


for qq in range(int(input())):
	(n, k) = map(int, input().split())
	if n % 2:
		if k % 2:
			if n < k:
				print('NO')
			else:
				print('YES')
				ans = [1] * (k - 1)
				ans.append(n - k + 1)
				print(*ans)
		else:
			print('NO')
	else:
		if k % 2 == 0:
			if n >= k:
				print('YES')
				ans = [1] * (k - 1)
				ans.append(n - k + 1)
				print(*ans)
				continue
		if n < 2 * k:
			print('NO')
		else:
			print('YES')
			ans = [2] * (k - 1)
			ans.append(n - 2 * (k - 1))
			print(*ans)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	flag1 = 0
	flag0 = 0
	if (n - (k - 1)) % 2 == 1 and n - k >= 0:
		flag1 = 1
	if (n - 2 * (k - 1)) % 2 == 0 and n - 2 * k >= 0:
		flag0 = 1
	if flag1 == 0 and flag0 == 0:
		print('NO')
	else:
		print('YES')
		ans = []
		if flag1:
			for i in range(k - 1):
				ans.append(1)
			ans.append(n - k + 1)
		else:
			for i in range(k - 1):
				ans.append(2)
			ans.append(n - (k - 1) * 2)
		print(*ans)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = []
	if k == 1:
		print('YES')
		print(n)
		continue
	s1 = k - 1
	s2 = 2 * (k - 1)
	y1 = n - s1
	y2 = n - s2
	if y1 > 0 and y1 % 2 != 0:
		print('YES')
		b = [1] * (k - 1)
		x = n - s1
		b.append(x)
		print(*b)
	elif y2 > 0 and y2 % 2 == 0:
		print('YES')
		b = [2] * (k - 1)
		x = n - s2
		b.append(x)
		print(*b)
	else:
		print('NO')


def main(n, k):
	if (n - 2 * (k - 1)) % 2 == 0 and n - 2 * (k - 1) > 0:
		print('YES')
		print((str(2) + ' ') * (k - 1) + str(n - 2 * (k - 1)))
		return
	if (n - k + 1) % 2 == 1 and n - k + 1 > 0:
		print('YES')
		print('1 ' * (k - 1) + str(n - k + 1))
		return
	print('NO')
t = int(input())
for i in range(t):
	(n, k) = [int(i) for i in input().split()]
	main(n, k)


T = int(input())
for k in range(T):
	(n, k) = map(int, input().split())
	odd_no = n - (k - 1)
	even_no = n - 2 * (k - 1)
	if odd_no > 0 and odd_no % 2 != 0:
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(odd_no)
	elif even_no > 0 and even_no % 2 == 0:
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		print(even_no)
	else:
		print('NO')


import sys
import os
import math
import copy
from math import gcd
from bisect import bisect
from io import BytesIO, IOBase
from math import sqrt, floor, factorial, gcd, log, ceil
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations

def Int():
	return int(sys.stdin.readline())

def Mint():
	return map(int, sys.stdin.readline().split())

def Lstr():
	return list(sys.stdin.readline().strip())

def Str():
	return sys.stdin.readline().strip()

def Mstr():
	return map(str, sys.stdin.readline().strip().split())

def List():
	return list(map(int, sys.stdin.readline().split()))

def Hash():
	return dict()

def Mod():
	return 1000000007

def Ncr(n, r, p):
	return fact[n] * (ifact[r] * ifact[n - r] % p) % p

def Most_frequent(list):
	return max(set(list), key=list.count)

def Mat2x2(n):
	return [List() for _ in range(n)]

def btod(n):
	return int(n, 2)

def dtob(n):
	return bin(n).replace('0b', '')

def solution():
	for _ in range(Int()):
		(total, n) = Mint()
		ans = []
		if (total - 2 * (n - 1)) % 2 == 0 and total - 2 * (n - 1) > 0:
			print('YES')
			for i in range(n - 1):
				ans.append(2)
			ans.append(total - 2 * (n - 1))
			print(*ans)
		elif (total - 1 * (n - 1)) % 2 != 0 and total - 1 * (n - 1) > 0:
			print('YES')
			for i in range(n - 1):
				ans.append(1)
			ans.append(total - 1 * (n - 1))
			print(*ans)
		else:
			print('NO')
solution()


import math
t = int(input())
for _ in range(t):
	(n, k) = [int(x) for x in input().split()]
	if k > n:
		print('NO')
		continue
	if k == n:
		print('YES')
		print(' '.join((str(1) for x in range(k))))
		continue
	if n & 1:
		if k & 1:
			print('YES')
			while k > 1:
				print('1', end=' ')
				n -= 1
				k -= 1
			print(n)
		else:
			print('NO')
	elif n - (k - 1) * 2 > 0 and (n - (k - 1) * 2) % 2 == 0:
		print('YES')
		while k > 1:
			print('2', end=' ')
			n -= 2
			k -= 1
		print(n)
	elif n - k + 1 > 0 and n - k + 1 & 1:
		print('YES')
		while k > 1:
			print('1', end=' ')
			n -= 1
			k -= 1
		print(n)
	else:
		print('NO')


def same(j):
	if j[1] > j[0]:
		print('NO')
	elif j[0] % 2 == 0:
		if j[1] % 2 == 0:
			print('YES')
			print('1 ' * (j[1] - 1) + str(j[0] - j[1] + 1))
		elif j[0] - 2 * j[1] + 2 > 0:
			print('YES')
			print('2 ' * (j[1] - 1) + str(j[0] - 2 * j[1] + 2))
		else:
			print('NO')
	elif j[1] % 2 == 0:
		print('NO')
	else:
		print('YES')
		print('1 ' * (j[1] - 1) + str(j[0] - j[1] + 1))
t = int(input())
l = []
for i in range(t):
	(n, k) = input().split()
	l.append([int(n), int(k)])
for j in l:
	same(j)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	ans = []
	good = False
	p = False
	if n % 2 == 0 and k <= n / 2:
		good = True
		x = 0
		while x < k:
			if x + 1 == k:
				if n - sum(ans) > 0 and (n - sum(ans)) % 2 == 0:
					ans.append(n - sum(ans))
				else:
					good = False
			else:
				ans.append(2)
			x += 1
		if good:
			p = True
			print('YES')
			print(*ans)
	if k <= n and (not p):
		good = True
		x = 0
		while x < k:
			if x + 1 == k:
				if n - sum(ans) > 0 and (n - sum(ans)) % 2 == 1:
					ans.append(abs(n - sum(ans)))
				else:
					good = False
			else:
				ans.append(1)
			x += 1
		if good:
			p = True
			print('YES')
			print(*ans)
	if not p:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n == k:
		print('YES')
		print('1 ' * n)
	elif n < k:
		print('NO')
	else:
		temp = n - k + 1
		if temp % 2 == 1:
			print('YES')
			print(temp, end=' ')
			print('1 ' * (k - 1))
		else:
			x = temp - (k - 1)
			if x <= 0:
				print('NO')
			elif x % 2 == 0:
				print('YES')
				print(x, end=' ')
				print('2 ' * (k - 1))
			else:
				print('NO')


import math
t = int(input())
for j in range(t):
	(n, k) = map(int, input().split())
	if n % 2 == k % 2:
		if k > n:
			print('NO')
		else:
			print('YES')
			for i in range(k - 1):
				print(1, end=' ')
				n = n - 1
			print(n)
	elif n % 2 or 2 * k > n:
		print('NO')
	else:
		print('YES')
		if k - 1 == 1:
			print(n)
		else:
			for i in range(k - 1):
				print(2, end=' ')
				n = n - 2
			print(n)


from collections import *
from bisect import *
from math import *
import sys
input = sys.stdin.readline
t = int(input())
while t:
	t -= 1
	(n, k) = map(int, input().split())
	if k > n or (n % 2 and k % 2 == 0):
		print('NO')
		continue
	if n % 2:
		print('YES')
		print(*[1] * (k - 1), end=' ')
		print(n - (k - 1))
	elif k % 2:
		s = 2 * (k - 1)
		if (n - s) % 2 or n - 2 * (k - 1) <= 0:
			print('NO')
			continue
		print('YES')
		print(*[2] * (k - 1), end=' ')
		print(n - 2 * (k - 1))
	else:
		print('YES')
		print(*[1] * (k - 1), end=' ')
		print(n - (k - 1))


c = int(input())
for i in range(c):
	(n, m) = map(int, input().split())
	n -= m - 1
	if n > 0 and n % 2 != 0:
		print('YES')
		print('1 ' * (m - 1), n)
		continue
	n += m - 1
	n -= (m - 1) * 2
	if n > 0 and n % 2 == 0:
		print('YES')
		print('2 ' * (m - 1), n)
		continue
	print('NO')


def func(x):
	x = x.split()
	if len(x) == 1:
		return int(x[0])
	x = [int(each) for each in x]
	return x
import sys
inputs = []
for line in sys.stdin:
	inputs += [line.split('\n')[0]]
inputs = [func(each) for each in inputs]
for i in range(inputs[0]):
	(n, k) = (inputs[i + 1][0], inputs[i + 1][1])
	last_even = n - (2 * k - 2)
	if (last_even > 0) & (last_even % 2 == 0):
		ans = [2] * (k - 1) + [last_even]
		ans = [str(each) for each in ans]
		print('YES')
		print(' '.join(ans))
		continue
	last_odd = n - k + 1
	if (last_odd > 0) & (last_odd % 2 != 0):
		ans = [1] * (k - 1) + [last_odd]
		ans = [str(each) for each in ans]
		print('YES')
		print(' '.join(ans))
		continue
	print('No')


t = int(input())

def solve(n, k):
	ans = False
	new_n = n - (k - 1) * 2
	new_nodd = n - (k - 1)
	if new_n > 0 and new_n % 2 == 0:
		ans = True
		st = ' '.join(('2' for i in range(k - 1))) + ' ' + str(new_n)
		print('YES')
		print(st)
	elif new_nodd > 0 and new_nodd % 2 == 1:
		ans = True
		st = ' '.join(('1' for i in range(k - 1))) + ' ' + str(new_nodd)
		print('YES')
		print(st)
	else:
		print('NO')
while t:
	t -= 1
	(n, k) = list(map(int, input().split(' ')))
	solve(n, k)


t = int(input())
AnsList = []
for _ in range(t):
	(n, k) = map(int, input().split())
	ans = []
	if not k > n:
		if n % 2 == 0:
			if k % 2 == 0:
				ans = [1 for _ in range(k - 1)]
				ans.append(n - k + 1)
			elif not n < 2 * k:
				ans = [2 for _ in range(k - 1)]
				ans.append(n - 2 * k + 2)
		elif k % 2 == 1:
			ans = [1 for _ in range(k - 1)]
			ans.append(n - k + 1)
	AnsList.append(ans)
for l in AnsList:
	if l == []:
		print('NO')
	else:
		print('YES')
		print(' '.join(map(str, l)))


no = int(input())
inList = []
mainList = []
yesNoList = []
for i in range(0, no):
	temp = []
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	temp.append(a)
	temp.append(b)
	inList.append(temp)
for i in inList:
	if i[0] >= i[1]:
		nEven = True if i[0] % 2 == 0 else False
		kEven = True if i[1] % 2 == 0 else False
		if kEven == True and nEven == False:
			mainList.append([])
			yesNoList.append('NO')
		elif kEven == True and nEven == True or (kEven == False and nEven == False):
			temp = [1] * i[1]
			if 1 * i[1] <= i[0]:
				temp[len(temp) - 1] = temp[len(temp) - 1] + (i[0] - i[1])
				if temp[len(temp) - 1] % 2 == 1:
					mainList.append(temp)
					yesNoList.append('YES')
				else:
					mainList.append([])
					yesNoList.append('NO')
			else:
				mainList.append([])
				yesNoList.append('NO')
		elif kEven == False and nEven == True or (kEven == True and nEven == False):
			temp = [2] * i[1]
			if 2 * i[1] <= i[0]:
				temp[len(temp) - 1] = temp[len(temp) - 1] + (i[0] - 2 * i[1])
				if temp[len(temp) - 1] % 2 == 0:
					mainList.append(temp)
					yesNoList.append('YES')
				else:
					mainList.append([])
					yesNoList.append('NO')
			else:
				mainList.append([])
				yesNoList.append('NO')
	else:
		mainList.append([])
		yesNoList.append('NO')
for i in range(0, no):
	print(yesNoList[i])
	c = 0
	for j in mainList[i]:
		c = c + 1
		if c != len(mainList[i]):
			print(j, end=' ')
		else:
			print(j)


t = int(input())
while t > 0:
	(n, k) = [int(x) for x in input().split()]
	check = True
	if n % 2 == 0 and k % 2 != 0:
		x = [2] * (k - 1)
		if n - sum(x) > 0:
			x.append(n - sum(x))
			print('YES')
			print(*x)
		else:
			print('NO')
	elif n % 2 == 0 and k % 2 == 0:
		x = [1] * (k - 1)
		if n - sum(x) > 0:
			x.append(n - sum(x))
			print('YES')
			print(*x)
		else:
			x = [2] * (k - 1)
			if n - sum(x) > 0:
				x.append(n - sum(x))
				print('YES')
				print(*x)
			else:
				print('NO')
	elif n % 2 != 0 and k % 2 != 0:
		x = [1] * (k - 1)
		if n - sum(x) > 0:
			x.append(n - sum(x))
			print('YES')
			print(*x)
		else:
			print('NO')
	else:
		print('NO')
	t -= 1


t = int(input())
for i in range(t):
	(n, k) = [int(i) for i in input().split()]
	if k == 0 or k > n:
		print('NO')
		continue
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
		continue
	elif n % 2 == 1 and k % 2 == 1 or (n % 2 == 0 and k % 2 == 0):
		a = [1] * (k - 1)
		n -= k - 1
		a.append(n)
	else:
		a = [2] * (k - 1)
		n -= 2 * (k - 1)
		a.append(n)
		if n <= 0:
			print('NO')
			continue
	print('YES')
	for i in a:
		print(i, end=' ')
	print()


from sys import stdin, stdout
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a % 2 != 0 and b % 2 == 0:
		print('NO')
		continue
	x = a
	res = []
	for i in range(b - 1):
		res.append(1 if b % 2 == 0 or a % 2 != 0 else 2)
		x -= 1 if b % 2 == 0 or a % 2 != 0 else 2
	if x <= 0 or x % 2 != (1 if b % 2 == 0 or a % 2 != 0 else 0):
		print('NO')
		continue
	res.append(x)
	print('YES')
	print(*res)


import sys, bisect
from math import gcd
input = sys.stdin.readline

def inp():
	return int(input().rstrip())

def inlt():
	return list(map(int, input().rstrip().split()))

def insr():
	s = input().rstrip()
	return s[:len(s) - 1]

def invr():
	return map(int, input().rstrip().split())
t = inp()
for _ in range(t):
	(n, k) = invr()
	ans = []
	if k > n:
		print('NO')
	elif k == n:
		ans = []
		for i in range(k):
			ans.append(1)
		print('YES')
		print(*ans)
	elif n % 2 == 0 and k % 2 != 0:
		if n < 2 * k:
			print('NO')
		else:
			result = n - 2 * (k - 1)
			ans.append(result)
			for i in range(k - 1):
				ans.append(2)
			print('YES')
			print(*ans)
	elif n % 2 != 0 and k % 2 == 0:
		print('NO')
	else:
		result = n - (k - 1)
		ans.append(result)
		for i in range(k - 1):
			ans.append(1)
		print('YES')
		print(*ans)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a % 2 == 0 and (a >= b * 2 or b % 2 == 0) and (b <= a):
		print('YES')
		if a >= b * 2:
			l = [2] * (b - 1) + [a - (b - 1) * 2]
			print(*l)
		else:
			l = [1] * (b - 1) + [a - (b - 1)]
			print(*l)
	elif a % 2 != 0 and b % 2 != 0 and (b <= a):
		print('YES')
		l = [1] * (b - 1) + [a - (b - 1)]
		print(*l)
	else:
		print('NO')


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	a1 = a - (b - 1)
	a2 = a - 2 * (b - 1)
	if a1 > 0 and a1 % 2 == 1:
		print('YES')
		for i in range(b - 1):
			print(1, end=' ')
		print(a1)
	elif a2 > 0 and a2 % 2 == 0:
		print('YES')
		for i in range(b - 1):
			print(2, end=' ')
		print(a2)
	else:
		print('NO')


for t in range(int(input())):
	(n, k) = map(int, input().split())
	ans = []
	control = 1
	if n % 2 == 1 and k % 2 == 0:
		control = 0
	elif n % 2 == 0 and k % 2 == 1:
		for i in range(1, k + 1):
			ans.append(2)
			n -= 2
		if n < 0:
			control = 0
		else:
			ans[-1] += n
	else:
		for i in range(1, k + 1):
			ans.append(1)
			n -= 1
		if n < 0:
			control = 0
		else:
			ans[-1] += n
	if control == 0:
		print('NO')
	else:
		print('YES')
		for i in range(len(ans)):
			print(ans[i], end=' ')


from sys import stdin, stdout
import bisect

def main():
	for _ in range(int(stdin.readline())):
		(n, k) = map(int, stdin.readline().split())
		if k == 1:
			print('YES')
			print(n)
		elif k > n:
			print('NO')
		elif n == k:
			print('YES')
			for i in range(k):
				print(1, end=' ')
			print()
		elif n % 2 == 0:
			if k <= n // 2:
				print('YES')
				for i in range(k - 1):
					print(2, end=' ')
					n = n - 2
				print(n)
			elif n % k == 0:
				for i in range(k):
					print(n // k, end=' ')
				print()
			elif k % 2 == 0 and k > n // 2:
				print('YES')
				for i in range(k - 1):
					print(1, end=' ')
					n = n - 1
				print(n)
			else:
				print('NO')
		elif n % k == 0:
			print('YES')
			for i in range(k):
				print(n // k, end=' ')
			print()
		elif k < n and k % 2 != 0:
			print('YES')
			for i in range(k - 1):
				print(1, end=' ')
				n = n - 1
			print(n)
		else:
			print('NO')
main()


def one_case():
	(n, k) = map(int, input().split())
	p1 = n - 1 * (k - 1)
	if p1 > 0 and p1 % 2 == 1:
		l = [1] * (k - 1)
		l.append(p1)
		print('YES')
		print(' '.join([str(i) for i in l]))
		return True
	p2 = n - 2 * (k - 1)
	if p2 > 0 and p2 % 2 == 0:
		l = [2] * (k - 1)
		l.append(p2)
		print('YES')
		print(' '.join([str(i) for i in l]))
		return True
	print('NO')
	return False
t = int(input())
for i in range(t):
	one_case()


for test in range(int(input())):
	(n, k) = map(int, input().split())
	lt = []
	if n / k == n // k:
		print('YES')
		for i in range(k):
			lt.append(n // k)
		print(*lt, sep=' ')
	elif n == k:
		print('YES')
		for i in range(k):
			lt.append(1)
		print(*lt, sep=' ')
	elif (n - 2 * (k - 1)) % 2 == 0 and n - 2 * (k - 1) > 0:
		print('YES')
		for i in range(k - 1):
			lt.append(2)
		lt.append(n - 2 * (k - 1))
		print(*lt, sep=' ')
	elif (n - (k - 1)) % 2 != 0 and n - k - 1 > 0:
		print('YES')
		for i in range(k - 1):
			lt.append(1)
		lt.append(n - k + 1)
		print(*lt, sep=' ')
	else:
		print('NO')


for i in range(int(input())):
	(n, m) = [int(s) for s in input().split()]
	if n % 2 == m % 2:
		if m > n:
			print('NO')
		else:
			print('YES')
			print('1 ' * (m - 1), n - m + 1, sep='')
	if n % 2 == 1 and m % 2 == 0:
		print('NO')
	if n % 2 == 0 and m % 2 == 1:
		if 2 * m > n:
			print('NO')
		else:
			print('YES')
			print('2 ' * (m - 1), n - m * 2 + 2, sep='')


tests = int(input())
for test in range(tests):
	(n, k) = map(int, input().split())
	if n < k:
		print('NO')
		continue
	if (n - k) % 2 == 0:
		print('YES')
		for i in range(k - 1):
			print(1)
		print(n - k + 1)
		continue
	if n % 2 == 0:
		if 2 * (k - 1) < n:
			print('YES')
			for i in range(k - 1):
				print(2)
			print(n - 2 * (k - 1))
		else:
			print('NO')
	else:
		print('NO')


T = int(input())
for t in range(T):
	(n, k) = [int(i) for i in input().split()]
	if n % 2 == 0:
		if k % 2 == 1:
			if n - 2 * (k - 1) > 0:
				print('YES')
				ans = [2 for i in range(k - 1)] + [n - 2 * (k - 1)]
				print(*ans)
			else:
				print('NO')
		elif n - (k - 1) > 0:
			print('YES')
			ans = [1 for i in range(k - 1)] + [n - (k - 1)]
			print(*ans)
		else:
			print('NO')
	elif k % 2 == 0:
		print('NO')
	elif n - (k - 1) > 0:
		print('YES')
		ans = [1 for i in range(k - 1)] + [n - (k - 1)]
		print(*ans)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	flag = 1
	z = k - 1
	o = z * 1
	e = z * 2
	if o < n and (n - o) % 2 == 1:
		print('YES')
		j = list('1' * z)
		print(*j, n - o)
	elif e < n and (n - e) % 2 == 0:
		print('YES')
		j = list('2' * z)
		print(*j, n - e)
	else:
		print('NO')


c = int(input())
for _ in range(c):
	str = input().split()
	n = int(str[0])
	k = int(str[1])
	if k % 2 == 0:
		if n % 2 == 0:
			if k <= n:
				print('YES')
				for i in range(k):
					if i + 1 != k:
						print(1, end=' ')
					else:
						print(n - k + 1, end='')
			else:
				print('NO')
				continue
		else:
			print('NO')
			continue
	elif n % 2 == 1:
		if k <= n:
			print('YES')
			for i in range(k):
				if i + 1 != k:
					print(1, end=' ')
				else:
					print(n - k + 1, end='')
		else:
			print('NO')
			continue
	elif k * 2 <= n:
		print('YES')
		for i in range(k):
			if i + 1 != k:
				print(2, end=' ')
			else:
				print(n - 2 * (k - 1), end='')
	else:
		print('NO')
		continue
	print()


test_count = int(input())

def O(n, k):
	p = n - k + 1
	for i in range(k - 1):
		print('1', end=' ')
	print(str(p))

def E(n, k):
	p = n - 2 * k + 2
	for i in range(k - 1):
		print('2', end=' ')
	print(str(p))

def ans(p):
	(n, k) = p
	if k % 2 == 0:
		if n % 2 == 0:
			if k <= n:
				print('YES')
				O(n, k)
			else:
				print('NO')
		else:
			print('NO')
	elif n % 2 == 0:
		if 2 * k <= n:
			print('YES')
			E(n, k)
		else:
			print('NO')
	elif k <= n:
		print('YES')
		O(n, k)
	else:
		print('NO')
for i in range(test_count):
	ans(list(map(lambda x: int(x), input().split(' '))))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n - (k - 1) > 0 and (n - (k - 1)) % 2:
		tmp = [1] * (k - 1) + [n - (k - 1)]
		print('Yes')
		print(*tmp)
		continue
	if n - 2 * (k - 1) > 0 and (n - 2 * (k - 1)) % 2 == 0:
		tmp = [2] * (k - 1) + [n - 2 * (k - 1)]
		print('Yes')
		print(*tmp)
		continue
	print('No')


lst = []
i = int(input())
for i in range(0, i):
	lst.append(input().split())
for i in range(0, len(lst)):
	x = int(lst[i][0])
	y = int(lst[i][1])
	if y > x:
		print('NO')
		continue
	if x % 2 != 0 and y % 2 == 0:
		print('NO')
		continue
	if x % 2 == 0 and y % 2 == 0:
		lst1 = [1] * (y - 1)
		lst1.append(x + 1 - y)
		print('YES')
		for j in lst1:
			print(j, end=' ')
		print('\n', end='')
	elif x % 2 == 0 and y % 2 != 0:
		if x >= y * 2:
			lst1 = [2] * (y - 1)
			lst1.append(x + 2 - 2 * y)
			print('YES')
			for j in lst1:
				print(j, end=' ')
			print('\n', end='')
		else:
			print('NO')
	else:
		lst1 = [1] * (y - 1)
		lst1.append(x + 1 - y)
		print('YES')
		for j in lst1:
			print(j, end=' ')
		print('\n', end='')


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
mod = 1000000007
import math
import bisect
abc = 'abcdefghijklmnopqrstuvwxyz'

def main():
	for _ in range(ii()):
		(n, k) = mi()
		if k == n:
			print('YES')
			for i in range(n):
				print(1, end=' ')
			print()
			continue
		if k > n:
			print('NO')
			continue
		if n % 2 and k % 2 == 0:
			print('NO')
		elif n % 2 == 0 and k % 2 and (n // k < 2):
			print('NO')
		elif n % 2 == 0 and k % 2:
			print('YES')
			for i in range(k - 1):
				print(2, end=' ')
			print(n - (k - 1) * 2)
		elif n % 2 and k % 2:
			print('YES')
			for i in range(k - 1):
				print(1, end=' ')
			print(n - (k - 1))
		else:
			print('YES')
			for i in range(k - 1):
				print(1, end=' ')
			print(n - (k - 1))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for bioqerrqer in range(int(input())):
	(n, k) = map(int, input().split())
	if k > n:
		print('No')
		continue
	if (n - k + 1) % 2 == 1:
		l = [1] * k
		l[0] = n - k + 1
		print('Yes')
		print(*l)
	elif n >= 2 * k and (n - 2 * k) % 2 == 0:
		l = [2] * k
		l[0] = n - 2 * k + 2
		print('Yes')
		print(*l)
	else:
		print('No')


t = int(input())
while t:
	t = t - 1
	(n, k) = map(int, input().split())
	f = 0
	ans = []
	if k > n:
		print('NO')
	elif n % 2 == 0 and k % 2 != 0:
		for w in range(k - 1):
			if n <= 0:
				print('NO')
				f = 1
				break
			ans.append(2)
			n -= 2
		if n <= 0 and f == 0:
			print('NO')
		elif f == 0:
			print('YES')
			ans.append(n)
			for w in ans:
				print(w, end=' ')
			print()
	elif n % 2 == 0 and k % 2 == 0:
		for w in range(k - 1):
			if n <= 0:
				print('NO')
				f = 1
				break
			ans.append(1)
			n -= 1
		if n <= 0 and f == 0:
			print('NO')
		elif f == 0:
			print('YES')
			ans.append(n)
			for w in ans:
				print(w, end=' ')
			print()
	elif n % 2 != 0 and k % 2 == 0:
		print('NO')
	elif n % 2 != 0 and k % 2 != 0:
		for w in range(k - 1):
			if n <= 0:
				print('NO')
				f = 1
				break
			ans.append(1)
			n -= 1
		if n <= 0 and f == 0:
			print('NO')
		elif f == 0:
			print('YES')
			ans.append(n)
			for w in ans:
				print(w, end=' ')
			print()


import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = n - (k - 1)
	if a > 0 and a & 1:
		print('YES')
		for i in range(k - 1):
			print('1', end=' ')
		print(a)
		continue
	b = n - 2 * (k - 1)
	if b > 0 and b % 2 == 0:
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		print(b)
		continue
	print('NO')


def parity(n, k):
	lst = []
	s = 'YES'
	if n % 2 != 0 and k % 2 == 0:
		return ('NO', [])
	elif n % 2 == 0 and k <= n // 2:
		lst += ['2'] * (k - 1)
		last = n - 2 * (k - 1)
		if last % 2 != 0 or last <= 0:
			return ('NO', [])
		lst.append(str(last))
	else:
		lst += ['1'] * (k - 1)
		last = n - 1 * (k - 1)
		if last % 2 == 0 or last <= 0:
			return ('NO', [])
		lst.append(str(last))
	return (s, lst)
t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	(s, arr) = parity(n, k)
	if s == 'NO':
		print(s)
	else:
		print(s)
		print(' '.join(arr))


import sys
input = sys.stdin.readline
tc = int(input())
for _ in range(tc):
	(n, k) = list(map(int, input().split()))
	nc = 'odd' if n % 2 == 1 else 'even'
	kc = 'odd' if k % 2 == 1 else 'even'
	if nc == 'even' and kc == 'odd':
		if n // 2 > k - 1:
			print('YES')
			print('2 ' * (k - 1) + str(n - 2 * (k - 1)))
		else:
			print('NO')
	elif nc == 'odd' and kc == 'even':
		print('NO')
	elif nc == kc:
		if n > k - 1:
			print('YES')
			print('1 ' * (k - 1) + str(n - (k - 1)))
		else:
			print('NO')


t = int(input())
for _ in range(t):
	(n, q) = list(map(int, input().split()))
	if n < q:
		print('NO')
	elif n % 2 == 1 and q % 2 == 0:
		print('NO')
	elif n % 2 == 0:
		if q % 2 == 1:
			if n // q == 1:
				print('NO')
			else:
				print('YES')
				print('2 ' * (q - 1), end='')
				print(n - (q - 1) * 2)
		else:
			print('YES')
			if n // q == 1:
				print('1 ' * (q - 1), end='')
				print(n + 1 - q)
			else:
				print('2 ' * (q - 1), end='')
				print(n - (q - 1) * 2)
	else:
		print('YES')
		print('1 ' * (q - 1), end='')
		print(n + 1 - q)


for nt in range(int(input())):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
		continue
	if k == n:
		print('YES')
		ans = [1] * k
		print(*ans)
		continue
	if n % 2 and k % 2 == 0:
		print('NO')
		continue
	if (n - k + 1) % 2:
		print('YES')
		ans = [1] * (k - 1)
		ans.append(n - k + 1)
		print(*ans)
	elif n % 2 == 0 and k % 2:
		if n - (k - 1) * 2 >= 2 and (n - (k - 1) * 2) % 2 == 0:
			print('YES')
			ans = [2] * (k - 1)
			ans.append(n - 2 * (k - 1))
			print(*ans)
		else:
			print('NO')


t = int(input())
for z in range(t):
	(n, k) = map(int, input().split())
	arr = []
	if abs(n - k) % 2 == 0:
		if k <= n:
			print('YES')
			arr = [1 for i in range(k - 1)]
			arr.append(n - k + 1)
			print(*arr)
		else:
			print('NO')
	elif n % 2 == 0 and k <= n // 2:
		print('YES')
		arr = [2 for i in range(k - 1)]
		arr.append(n - 2 * k + 2)
		print(*arr)
	else:
		print('NO')


x = int(input())
m = []
for f in range(x):
	m.append(input().split(' '))
for f in m:
	a = int(f[0])
	b = int(f[1])
	if a % b == 0:
		print('YES')
		for i in range(b):
			print(a // b, ' ', end='')
		print()
	elif a // b > 0 and a // b % 2 == (a // b + a % b) % 2:
		print('YES')
		for i in range(b):
			print(a // b + (a % b if i == b - 1 else 0), ' ', end='')
		print()
	elif (b - 1) % 2 == 0 and a // b > 1:
		print('YES')
		c = 1
		for i in range(b):
			print(a // b + (a % b if i == b - 1 else c), ' ', end='')
			c = c * -1
		print()
	else:
		print('NO')


from math import *
from collections import *
from itertools import *
from bisect import *

def io():
	return map(int, input().split())

def op():
	return list(map(int, input().split()))

def kl(con, x=0):
	if x == 0:
		print('Yes') if con else print('No')
	elif x == 1:
		print('yes') if con else print('no')
	elif x == 2:
		print('YES') if con else print('NO')
MOD = 1000000007
MAX = 2147483647
MIN = -2147483648
p = input
for _ in range(int(p())):
	l = []
	(a, b) = io()
	if a & 1 and (not b & 1):
		kl(0, 2)
		continue
	if not a & 1 and b & 1:
		rem = a - (b - 1) * 2
		l = [2] * (b - 1)
		if rem <= 0 or rem & 1:
			kl(0, 2)
			continue
		else:
			l.append(rem)
	else:
		rem = a - (b - 1)
		l = [1] * (b - 1)
		if rem <= 0 or not rem & 1:
			kl(0, 2)
			continue
		else:
			l.append(rem)
	kl(1, 2)
	print(*l)


t = int(input())
for _ in range(t):
	(n, k) = [int(i) for i in input().split(' ')]
	if k > n or (n % 2 == 1 and k % 2 == 0):
		print('NO')
		continue
	a = []
	if n == k:
		a = [1] * n
	elif k == 1:
		a = [n]
	elif n % 2 == 1 and k % 2 == 1 or (n % 2 == 0 and k % 2 == 0):
		a = [1] * (k - 1) + [n - k + 1]
	else:
		if n - (k - 1) * 2 <= 0:
			print('NO')
			continue
		a = [2] * (k - 1) + [n - (k - 1) * 2]
	print('YES')
	s = ''
	for i in a:
		s += f'{i} '
	print(s)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n < k:
		print('NO')
	elif n % k == 0:
		print('YES')
		li = [n // k] * k
		print(*li, sep=' ')
	else:
		x = n // k
		li = [x] * k
		y = x - 1
		li2 = [y] * k
		if x % 2 == (x + (n - k * x)) % 2:
			li[0] += n - k * x
			print('YES')
			print(*li, sep=' ')
		elif y != 0 and y % 2 == (y + (n - k * y)) % 2:
			li2[0] += n - k * y
			print('YES')
			print(*li2, sep=' ')
		else:
			print('NO')


x = int(input())
for i in range(x):
	(n, k) = input().split()
	(n, k) = (int(n), int(k))
	p = 1
	if n % 2 == 0 and k % 2 != 0 and (k <= n // 2):
		p = 2
		print('YES')
		for j in range(k - 1):
			print(2, end=' ')
		print(n - 2 * (k - 1))
	if n % 2 == 0 and k % 2 == 0 and (k <= n) or (n % 2 != 0 and k % 2 != 0 and (k <= n)):
		p = 2
		print('YES')
		for j in range(k - 1):
			print(1, end=' ')
		print(n - (k - 1))
	if p == 1:
		print('NO')


from sys import stdin, stdout
from math import gcd, ceil, sqrt
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
tc = ii1()
for _ in range(tc):
	(n, k) = iia()
	if n == k:
		print('YES')
		print(*['1'] * k)
	elif n - (k - 1) * 2 > 0 and (n - (k - 1) * 2) % 2 == 0:
		print('YES')
		print(*[2] * (k - 1), n - (k - 1) * 2)
	elif n - k - 1 > 0 and (n - k - 1) % 2 == 1:
		print('YES')
		print(*[1] * (k - 1), n - (k - 1))
	else:
		print('NO')


t = int(input())
for test in range(t):
	(n, k) = [int(x) for x in input().split()]
	num = []
	if n < k:
		print('NO')
		continue
	if k == 1:
		print('YES')
		print(n)
		continue
	if n % 2 == 0:
		if k % 2 == 0:
			kt = k - 1
			temp = n // k
			num.append(temp)
			digit = temp
			while kt != 1:
				num.append(temp)
				digit += temp
				kt -= 1
			num.append(n - digit)
		else:
			kt = k - 1
			temp = n // k
			if temp % 2 != 0:
				if temp == 1:
					temp = 2
				else:
					temp -= 1
			num.append(temp)
			digit = temp
			while kt != 1:
				num.append(temp)
				digit += temp
				kt -= 1
			if n - digit <= 0:
				print('NO')
				continue
			num.append(n - digit)
	elif k % 2 == 0:
		print('NO')
		continue
	else:
		kt = k - 1
		temp = n // k
		if temp % 2 == 0:
			temp -= 1
		num.append(temp)
		digit = temp
		while kt != 1:
			num.append(temp)
			digit += temp
			kt -= 1
		if n - digit < 0:
			print('NO')
			continue
		num.append(n - digit)
	print('YES')
	for i in range(len(num)):
		if i == len(num) - 1:
			print(num[i])
		else:
			print(num[i], end=' ')


cases = int(input())
for i in range(cases):
	line1 = input().split(' ')
	n = int(line1[0])
	k = int(line1[1])
	c1 = k - 1
	c2 = n - c1
	if c2 > 0 and c2 % 2 == 1:
		print('YES')
		for j in range(k - 1):
			print(1, end=' ')
		print(c2, end=' ')
		continue
	c3 = 2 * (k - 1)
	c4 = n - c3
	if c4 > 0 and c4 % 2 == 0:
		print('YES')
		for k in range(k - 1):
			print(2, end=' ')
		print(c4, end=' ')
		continue
	else:
		print('NO')
		continue


from sys import stdin

def inp():
	return stdin.buffer.readline().rstrip().decode('utf8')

def itg():
	return int(stdin.buffer.readline())

def mpint():
	return map(int, stdin.buffer.readline().split())

def solve():
	(n, k) = mpint()
	if k % 2 == 0 and n & 1 or n < k:
		return 'NO'
	if k == 1:
		return 'YES\n%d' % n
	if n == k:
		print('YES')
		return ('1 ' * k).rstrip()
	if n & 1:
		ans = [1] * (k - 1)
		n -= k - 1
		if n <= 0 or n % 2 == 0:
			return 'NO'
		ans.append(n)
		print('YES')
		return ' '.join(map(str, ans))
	if k & 1:
		ans = [2] * (k - 1)
		n -= 2 * (k - 1)
		if n <= 0:
			return 'NO'
		ans.append(n)
		print('YES')
		return ' '.join(map(str, ans))
	ans = [1] * (k - 1)
	n -= k - 1
	if n <= 0 or n % 2 == 0:
		return 'NO'
	ans.append(n)
	print('YES')
	return ' '.join(map(str, ans))
for case in range(itg()):
	print(solve())


from math import *
t = int(input())
while t > 0:
	(n, k) = [int(x) for x in input().split()]
	if n % 2 == 1 and k % 2 == 1:
		if n < k:
			print('NO')
		else:
			print('YES')
			for i in range(k - 1):
				print(1, end=' ')
			print(n - (k - 1))
	elif n % 2 == 0 and k % 2 == 0:
		if n < k:
			print('NO')
		else:
			print('YES')
			for i in range(k - 1):
				print(1, end=' ')
			print(n - (k - 1))
	elif n % 2 == 0 and k % 2 == 1:
		if n < 2 * k:
			print('NO')
		else:
			print('YES')
			for i in range(k - 1):
				print(2, end=' ')
			print(n - 2 * (k - 1))
	elif n % 2 == 1 and k % 2 == 0:
		print('NO')
	t -= 1


for tc in range(int(input())):
	(n, k) = [int(s) for s in input().split()]
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
		continue
	if n % 2 == 0 and k % 2 == 1:
		least = 2
	else:
		least = 1
	if least * k > n:
		print('NO')
		continue
	print('YES')
	print(*[n - least * k + least] + [least] * (k - 1))


import sys

def parity(n, k):
	oddRemainder = n - (k - 1)
	if oddRemainder > 0 and oddRemainder % 2 != 0:
		print('YES')
		return [1 if x < k - 1 else oddRemainder for x in range(k)]
	evenRemainder = n - 2 * (k - 1)
	if evenRemainder > 0 and evenRemainder % 2 == 0:
		print('YES')
		return [2 if x < k - 1 else evenRemainder for x in range(k)]
	return ['NO']
number_loops = int(input())
for _ in range(number_loops):
	inputs = list(map(int, input().split()))
	print(*parity(inputs[0], inputs[1]))


t = int(input())
for tt in range(t):
	(n, k) = map(int, input().split())
	x1 = n - (k - 1)
	x2 = n - 2 * (k - 1)
	if x1 > 0 and x1 % 2 == 1:
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(x1)
	elif x2 > 0 and x2 % 2 == 0:
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		print(x2)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	x = k - 1
	if n - x > 0 and n - x & 1:
		print('YES')
		l = [1] * (k - 1) + [n - x]
		print(*l)
		continue
	x = 2 * (k - 1)
	y = n - x
	if y > 0 and y & 1 == 0:
		print('YES')
		l = [2] * (k - 1) + [y]
		print(*l)
		continue
	print('NO')


t = int(input())
for _ in range(t):
	(y, z) = map(int, input().split())
	if y == z:
		print('YES')
		for i in range(y):
			print(1, end=' ')
		print()
		continue
	if z > y:
		print('NO')
		continue
	if y % 2 == 0:
		if z % 2 == 0:
			print('YES')
			for i in range(z - 1):
				print(1, end=' ')
			k = z - 1
			print(y - k)
		elif z * 2 > y:
			print('NO')
		else:
			print('YES')
			for i in range(z - 1):
				print(2, end=' ')
			k = (z - 1) * 2
			print(y - k)
	elif z % 2 == 0:
		print('NO')
	else:
		print('YES')
		for i in range(z - 1):
			print(1, end=' ')
		print(y - (z - 1))


from collections import Counter
from collections import defaultdict
import math
import sys
input = sys.stdin.readline
rs = lambda : input().strip()
ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))
rls = lambda : list(map(str, input().split()))
from collections import deque
t = int(input())
for _ in range(0, t):
	(a, k) = rl()
	g = a
	f = 1
	f1 = 0
	f2 = 0
	ans = []
	if a % 2 == 0 and k % 2 == 1:
		a = a - (k - 1) * 2
		if a <= 0:
			f = 0
		else:
			ans.extend([2] * (k - 1))
			ans.append(a)
	elif a % 2 == 1 and k % 2 == 1:
		a = a - (k - 1) * 1
		if a <= 0:
			f = 0
		else:
			ans.extend([1] * (k - 1))
			ans.append(a)
	elif a % 2 == 0 and k % 2 == 0:
		a = a - (k - 1) * 2
		if a <= 0 or a % 2 == 1:
			f = 0
		else:
			f2 = 1
			ans.extend([2] * (k - 1))
			ans.append(a)
		a = g
		a = a - (k - 1) * 1
		if a <= 0 or a % 2 == 0:
			f = 0
		elif f2 == 0:
			f1 = 1
			ans.extend([1] * (k - 1))
			ans.append(a)
	elif a % 2 == 1 and k % 2 == 0:
		a = a - (k - 1) * 1
		if a <= 0 or a % 2 == 0:
			f = 0
		else:
			ans.extend([1] * (k - 1))
			ans.append(a)
	if f1 or f2 or f:
		print('YES')
		print(*ans)
	else:
		print('NO')


def solve():
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
		return
	lst = []
	n1 = n - (k - 1)
	if n1 % 2 == 1 and n1 > 0:
		lst.extend([1] * (k - 1))
		lst.append(n1)
		print('YES')
		print(*lst)
		return
	n2 = n - 2 * (k - 1)
	if n2 % 2 == 0 and n2 > 0:
		lst.extend([2] * (k - 1))
		lst.append(n2)
		print('YES')
		print(*lst)
		return
	print('NO')
t = int(input())
while t:
	solve()
	t -= 1


T = int(input())
while T:
	(n, k) = map(int, input().split())
	if n % 2 != 0 and k % 2 == 0 or n < k:
		print('NO')
	elif n % 2 == k % 2:
		X = [n - (k - 1)]
		for i in range(k - 1):
			X.append(1)
		print('YES')
		print(*X)
	elif n % 2 == 0 and k % 2 != 0:
		if n - 2 * (k - 1) > 0:
			X = [n - 2 * (k - 1)]
			for i in range(k - 1):
				X.append(2)
			print('YES')
			print(*X)
		else:
			print('NO')
	T = T - 1


import math
for i in range(int(input())):
	(n, k) = map(int, input().split())
	l = []
	if n == k or (n % 2 == 0 and k % 2 == 0 and (n >= k)) or (n % 2 == 1 and k % 2 == 1 and (n >= k)):
		for p in range(k - 1):
			l.append(1)
		if n - (k - 1) > 0:
			l.append(n - k + 1)
		print('YES')
		print(*l)
		continue
	if math.ceil(n / 2) < k or (n % 2 == 1 and k % 2 == 0):
		print('NO')
		continue
	if n % 2 == 0 and k % 2 == 1:
		for p in range(k - 1):
			l.append(2)
		if n - 2 * k + 2 > 0:
			l.append(n - (k - 1) * 2)
	else:
		for p in range(k - 1):
			l.append(1)
		if n - k + 1 > 0:
			l.append(n - (k - 1) * 1)
	print('YES')
	print(*l)


t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	ans = []
	if n % 2 == 0:
		if k % 2 == 0:
			for i in range(k - 1):
				ans.append(1)
				n -= 1
			ans.append(n)
		else:
			for i in range(k - 1):
				ans.append(2)
				n -= 2
			ans.append(n)
	elif k % 2 == 0:
		ans.append(-1)
	else:
		for i in range(k - 1):
			ans.append(1)
			n -= 1
		ans.append(n)
	if min(ans) <= 0:
		print('NO')
	else:
		print('YES')
		print(*ans)


t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	if (n - 1 * (k - 1)) % 2 and n - 1 * (k - 1) > 0:
		res = 'YES'
		temp = [1] * (k - 1) + [n - 1 * (k - 1)]
	elif not (n - 2 * (k - 1)) % 2 and n - 2 * (k - 1) > 0:
		res = 'YES'
		temp = [2] * (k - 1) + [n - 2 * (k - 1)]
	else:
		res = 'NO'
	print(res)
	if res == 'YES':
		print(' '.join(map(str, temp)))


from typing import List

def GetParity(n: int, k: int) -> List[int]:
	Element = list()
	if 1 + (n - k) > 0 and (1 + (n - k)) % 2 == 1:
		for i in range(k):
			Element.append(1)
		Element[k - 1] += n - k
	elif 2 + (n - 2 * k) > 0 and (2 + (n - 2 * k)) % 2 == 0:
		for i in range(k):
			Element.append(2)
		Element[k - 1] += n - 2 * k
	return Element
t = int(input())
Result = list(list())
for i in range(t):
	(number, num_elements) = map(int, input().split())
	temp = GetParity(number, num_elements)
	Result.append(temp)
for el in Result:
	if len(el) == 0:
		print('NO')
	else:
		print('YES')
		for e in el:
			print(int(e), end=' ')
		print()


import sys, math, bisect
from collections import Counter, defaultdict as dd

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var))

def l():
	return list(sp())

def strl():
	return list(strsp())

def sp():
	return map(int, data().split())

def strsp():
	return map(str, data().split())
for _ in range(int(data())):
	(n, k) = sp()
	if (n - 2 * (k - 1)) % 2 == 0 and n - 2 * (k - 1) > 0:
		print('YES')
		a = [2] * (k - 1)
		a.append(n - 2 * (k - 1))
		print(*a)
	elif (n - (k - 1)) % 2 != 0 and n - (k - 1) > 0:
		print('YES')
		a = [1] * (k - 1)
		a.append(n - (k - 1))
		print(*a)
	else:
		print('NO')


for __ in range(int(input())):
	(n, k) = map(int, input().split())
	l = []
	s = 0
	f = 0
	c = 0
	for i in range(k):
		if s >= n:
			break
		if i != k - 1:
			l.append(2)
			s += 2
		if i == k - 1:
			p = n - s
			if p % 2 == 0:
				f = 1
				l.append(n - s)
				c += 1
	if f == 0:
		l.clear()
		s = 0
		for i in range(k):
			if s >= n:
				break
			if i != k - 1:
				l.append(1)
				s += 1
			if i == k - 1:
				p = n - s
				if p % 2 != 0:
					l.append(n - s)
					c += 1
	if c == 0:
		print('NO')
	else:
		print('YES')
		for i in range(k):
			print(l[i], end=' ')
		print()


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		s = ('1' + ' ') * b
		print('YES')
		print(s)
	elif a < b or (b == 2 and a % 2 != 0):
		print('NO')
	elif a - 2 * (b - 1) > 0 and (a - 2 * (b - 1)) % 2 == 0:
		print('YES')
		for i in range(b - 1):
			print('2', end=' ')
		print(a - 2 * (b - 1))
	elif a - (b - 1) > 0 and (a - (b - 1)) % 2 == 1:
		print('YES')
		for i in range(b - 1):
			print('1', end=' ')
		print(a - (b - 1))
	else:
		print('NO')


t = int(input())
for _ in range(t):
	s = input().split()
	n = int(s[0])
	k = int(s[1])
	af = 0
	if n % 2 == 0 and k % 2 == 0:
		z1 = n - k + 1
		z2 = n - 2 * (k - 1)
		if z1 % 2 == 1 and z1 >= 1 and (z1 + k - 1 == n):
			print('YES')
			for i in range(k - 1):
				print(1, end=' ')
			print(z1)
			af = 1
		elif z2 % 2 == 0 and z2 >= 2 and (af == 0) and (z2 + 2 * (k - 1) == n):
			print('YES')
			for i in range(k - 1):
				print(2, end=' ')
			print(z2)
			af = 1
	elif n % 2 == 0 and k % 2 == 1:
		z1 = n - k + 1
		z2 = n - 2 * (k - 1)
		if z2 % 2 == 0 and z2 >= 2 and (af == 0) and (z2 + 2 * (k - 1) == n):
			print('YES')
			for i in range(k - 1):
				print(2, end=' ')
			print(z2)
			af = 1
	elif n % 2 == 1 and k % 2 == 1:
		z1 = n - k + 1
		z2 = n - 2 * (k - 1)
		if z1 % 2 == 1 and z1 >= 1 and (z1 + k - 1 == n):
			print('YES')
			for i in range(k - 1):
				print(1, end=' ')
			print(z1)
			af = 1
	if af == 0:
		print('NO')


test = int(input())
for _ in range(test):
	(n, k) = map(int, input().split())
	if n & 1 and (not k & 1):
		print('NO')
		continue
	if k > n:
		print('NO')
		continue
	rem = n - k + 1
	if rem & 1 == 1:
		print('YES')
		print(*[1] * (k - 1), rem)
	else:
		rem = n - 2 * (k - 1)
		if rem <= 0 or rem & 1:
			print('NO')
		else:
			print('YES')
			print(*[2] * (k - 1), n - 2 * (k - 1))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if k == 1:
		print('YES\n' + str(n))
		continue
	par_n = n % 2
	par_k = k % 2
	if par_n == 1 and par_k == 0:
		print('No')
		continue
	if par_k == par_n:
		n -= k - 1
		if n <= 0:
			print('NO')
		else:
			print('YES\n' + '1 ' * (k - 1) + str(n))
	else:
		n -= (k - 1) * 2
		if n <= 0:
			print('NO')
		else:
			print('YES\n' + '2 ' * (k - 1) + str(n))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	t1 = n - (k - 1)
	t2 = n - (k - 1) * 2
	if t1 > 0 and t1 & 1:
		print('YES')
		print(' '.join([str(i) for i in [1 for _ in range(k - 1)] + [t1]]))
		continue
	if t2 > 0 and t2 & 1 == 0:
		print('YES')
		print(' '.join([str(i) for i in [2 for _ in range(k - 1)] + [t2]]))
		continue
	print('NO')


t = int(input())
for h in range(t):
	(k, n) = [int(x) for x in input().split()]
	m = k - n
	s = []
	if k % 2 != 0 and n % 2 == 0 or (abs(m) == 1 and (k != 2 and m != 1)) or m < 0:
		print('NO')
	elif k % 2 == 0 and n % 2 != 0:
		mm = k / 2
		if n > mm:
			print('NO')
		else:
			for j in range(n - 1):
				k = k - 2
				s.append(2)
			s.append(k)
			print('YES')
			for num in s:
				print(num, end=' ')
	elif k % 2 != 0 and n % 2 != 0:
		for j in range(n - 1):
			k = k - 1
			s.append(1)
		s.append(k)
		print('YES')
		for num in s:
			print(num, end=' ')
	elif (k % 2 == 0 and n % 2 == 0) and n <= k / 2:
		for j in range(n - 1):
			k = k - 2
			s.append(2)
		s.append(k)
		print('YES')
		for num in s:
			print(num, end=' ')
	elif (k % 2 == 0 and n % 2 == 0) and n > k / 2:
		for j in range(n - 1):
			k = k - 1
			s.append(1)
		s.append(k)
		print('YES')
		for num in s:
			print('\r')
			print(num, end=' ')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	ans = [0] * k
	is_ok = False
	if n % 2 == 0 and n >= 2 * k:
		is_ok = True
		for j in range(k - 1):
			ans[j] = 2
		ans[k - 1] = n - 2 * (k - 1)
	elif n >= k and (n - k) % 2 == 0:
		is_ok = True
		for j in range(k - 1):
			ans[j] = 1
		ans[k - 1] = n - (k - 1)
	if is_ok:
		print('YES')
		print(' '.join(map(str, ans)))
	else:
		print('NO')


n = int(input())
for i in range(n):
	(q, w) = list(map(int, input().split(' ')))
	if q - w > -1 and (q - w) % 2 == 0:
		print('YES')
		y = q - w + 1
		print(y, end=' ')
		for i in range(1, w):
			print('1', end=' ')
	elif q - 2 * w > -1 and (q - 2 * w) % 2 == 0:
		print('YES')
		y = q - 2 * w + 2
		print(y, end=' ')
		for i in range(1, w):
			print('2', end=' ')
	else:
		print('NO', end=' ')
	print()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	flag = 1
	if k > n:
		print('NO')
		flag = 0
	elif k == n:
		l = [1 for i in range(k)]
	elif n % 2 == 0 and k % 2:
		if n < 2 * k:
			print('NO')
			flag = 0
		else:
			l = [2 for i in range(k - 1)]
			l.append(n - sum(l))
	elif n % 2 == 0 and k % 2 == 0:
		l = [1 for i in range(k - 1)]
		l.append(n - sum(l))
	elif n % 2 and k % 2 == 0:
		flag = 0
		print('NO')
	elif n % 2 and k % 2:
		l = [1 for i in range(k - 1)]
		l.append(n - sum(l))
	if flag:
		print('YES')
		for i in l:
			print(i, end=' ')
		print()


t = int(input())
nk = [list(map(int, input().split())) for _ in range(t)]
for (n, k) in nk:
	if n < k:
		print('NO')
	elif n % 2 == 1 and k % 2 == 0:
		print('NO')
	else:
		ans = [n // k for _ in range(k)]
		left = n - sum(ans)
		if left % 2 == 1:
			if n // k > 1:
				ans = [n // k - 1 for _ in range(k)]
				left = n - sum(ans)
				ans[0] += left
				print('YES')
				print(*ans)
			else:
				print('NO')
		else:
			if left > 0:
				for i in range(k):
					ans[i] += 2
					left -= 2
					if left <= 0:
						break
			print('YES')
			print(*ans)


T = int(input())
for t in range(T):
	tmp = input().split()
	(n, k) = (int(tmp[0]), int(tmp[1]))
	if n < k:
		print('NO')
	else:
		lst = []
		if n % 2 == 1:
			for i in range(k - 1):
				lst.append(1)
			tmp = n - (k - 1)
			if tmp <= 0 or tmp % 2 == 0:
				print('NO')
			else:
				print('YES')
				lst.append(tmp)
				print(*lst)
		else:
			for i in range(k - 1):
				lst.append(1)
			tmp = n - (k - 1)
			if tmp <= 0 or tmp % 2 == 0:
				lst = []
				for i in range(k - 1):
					lst.append(2)
				tmp = n - 2 * (k - 1)
				if tmp <= 0 or tmp % 2 == 1:
					print('NO')
				else:
					print('YES')
					lst.append(tmp)
					print(*lst)
			else:
				print('YES')
				lst.append(tmp)
				print(*lst)


t = int(input())
for tt in range(t):
	(n, k) = map(int, input().split())
	last = n - (k - 1)
	if n % 2 == 1:
		if last > 0 and last % 2 == 1:
			print('YES')
			print('1 ' * (k - 1) + str(last))
		else:
			print('NO')
	elif last > 0 and last % 2 == 1:
		print('YES')
		print('1 ' * (k - 1) + str(last))
	elif n - 2 * (k - 1) > 0:
		print('YES')
		print('2 ' * (k - 1) + str(n - 2 * (k - 1)))
	else:
		print('NO')


def solve(n, k):
	if k > n:
		return 'NO'
	if n % 2 == 1 and k % 2 == 0:
		return 'NO'
	bases = [1]
	if n % 2 == 0:
		bases.append(2)
	for base in bases:
		out = [base] * (k - 1)
		rem = n - sum(out)
		if rem % 2 == base % 2 and rem > 0:
			out.append(rem)
			assert sum(out) == n
			assert len(out) == k
			return 'YES\n' + ' '.join(map(str, out))
	return 'NO'
T = int(input())
for (idx, _) in enumerate(range(T)):
	(n, k) = map(int, input().split(' '))
	print(solve(n, k))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
	elif n % 2 != 0 and k % 2 == 0:
		print('NO')
	else:
		lst = [2] * (k - 1)
		val = n - (k - 1) * 2
		if val > 1 and val % 2 == 0:
			lst.append(val)
			print('YES')
			print(*lst)
		else:
			lst = [1] * (k - 1)
			val = n - (k - 1)
			if val > 0 and val % 2 != 0:
				lst.append(val)
				rem = lst[0] % 2
				f = 0
				for i in lst:
					if i % 2 != rem:
						f = 1
						break
				if f == 1:
					print('NO')
				else:
					print('YES')
					print(*lst)
			else:
				print('NO')


test_cases = int(input())
while test_cases > 0:
	(num, k) = map(int, input().split())
	toPrint = []
	if num % 2 == 0:
		if k * 2 <= num:
			while k > 1:
				toPrint.append(2)
				num -= 2
				k -= 1
			toPrint.append(num)
			print('YES')
			print(*toPrint)
		else:
			while k > 1:
				toPrint.append(1)
				num -= 1
				k -= 1
			if num % 2 == 1 and num > 0:
				toPrint.append(num)
				print('YES')
				print(*toPrint)
			else:
				print('NO')
	elif k % 2 == 1 and num >= k:
		while k > 1:
			toPrint.append(1)
			num -= 1
			k -= 1
		toPrint.append(num)
		print('YES')
		print(*toPrint)
	else:
		print('NO')
	test_cases -= 1


n = int(input())
i = 0
while i < n:
	(x, y) = map(int, input().split(' '))
	if x >= y:
		if (x - 2 * (y - 1)) % 2 == 0 and x - 2 * (y - 1) > 0 and (x != y):
			print('YES')
			ans = []
			ans = [2] * (y - 1)
			ans = [2] * (y - 1)
			ans.append(x - 2 * (y - 1))
			print(' '.join(map(str, ans)))
		elif (x - (y - 1)) % 2 != 0 and x != y:
			print('YES')
			ans = []
			ans = [1] * (y - 1)
			ans.append(x - (y - 1))
			print(' '.join(map(str, ans)))
		elif x == y:
			print('YES')
			ans = []
			ans = [1] * y
			print(' '.join(map(str, ans)))
		else:
			print('NO')
	else:
		print('NO')
	i = i + 1


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
BUFSIZE = 8192
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	t = int(input())
	num = []
	for i in range(t):
		nk = list(map(int, input().split()))
		num.append(nk)
	for i in range(t):
		(n, k) = (num[i][0], num[i][1])
		if n < k:
			print('No')
			continue
		if n % 2 == 1 and k % 2 == 0:
			print('No')
			continue
		if n % k == 0:
			print('Yes')
			print(' '.join([str(n // k)] * k))
			continue
		res = n // k
		if n % 2 == 0:
			if res > 1:
				print('Yes')
				temp = [2] * (k - 1)
				temp.append(n - 2 * (k - 1))
				print(' '.join([str(x) for x in temp]))
			else:
				temp = [1] * (k - 1)
				if (n - sum(temp)) % 2 == 0:
					print('No')
				else:
					print('Yes')
					temp.append(n - (k - 1))
					print(' '.join([str(x) for x in temp]))
		if n % 2 == 1 and k % 2 == 1:
			print('Yes')
			temp = [1] * (k - 1)
			temp.append(n - (k - 1))
			print(' '.join([str(x) for x in temp]))
main()


from sys import stdin

def solve():
	(n, k) = [int(i) for i in stdin.readline().split()]
	l = n
	m = n
	A = ''
	for i in range(k - 1):
		if n <= 0:
			break
		n -= 2
		A += ' 2'
	if n > 0 and n % 2 == 0:
		A += ' ' + str(n)
		print('YES')
		print(A.strip())
		return 0
	A = ''
	for i in range(k - 1):
		if l <= 0:
			print('NO')
			return 0
		l -= 1
		A += ' 1'
	if l > 0 and l % 2 == 1:
		A += ' ' + str(l)
		print('YES')
		print(A.strip())
		return 0
	print('NO')
	return 0
t = int(input())
for i in range(t):
	k = solve()


from collections import defaultdict as dd
from collections import Counter as ccd
from itertools import permutations as pp
from itertools import combinations as cc
from random import randint as rd
from bisect import bisect_left as bl
from bisect import bisect_right as br
import heapq as hq
from math import gcd
mod = pow(10, 9) + 7

def inp(flag=0):
	if flag == 0:
		return list(map(int, input().strip().split(' ')))
	else:
		return int(input())
t = inp(1)
while t:
	t -= 1
	(n, k) = inp()
	possible = True
	if n - k + 1 > 0 and (n - k + 1) % 2 == 1:
		ans = [1] * (k - 1)
		ans.append(n - k + 1)
	elif n - 2 * (k - 1) > 0 and (n - 2 * (k - 1)) % 2 == 0:
		ans = [2] * (k - 1)
		ans.append(n - 2 * (k - 1))
	else:
		possible = False
	if possible:
		print('YES')
		print(*ans)
	else:
		print('NO')


import sys

def solve(x, y):
	if x == y:
		print('YES')
		print('1 ' * y)
	elif y == 1:
		print('YES')
		print(x)
	elif x < y or (x % 2 != 0 and y % 2 == 0) or x - y == 1:
		print('NO')
	elif x % 2 != 0 and y % 2 != 0 or (x % 2 == 0 and y % 2 == 0):
		print('YES')
		print(('1 ' * (y - 1)).strip(), x - (y - 1))
	elif x % 2 == 0 and y % 2 != 0:
		if x - (y - 1) * 2 <= 0:
			print('NO')
		else:
			print('YES')
			print(('2 ' * (y - 1)).strip(), x - (y - 1) * 2)

def main():
	n_cases = None
	for line in sys.stdin:
		if not n_cases:
			n_cases = line
			continue
		line = line.strip()
		line = line.rstrip()
		line = line.split(' ')
		x = int(line[0])
		y = int(line[1])
		solve(x, y)
main()


def odd():
	if n % 2 == 0 and k % 2 != 0 or (n % 2 != 0 and k % 2 == 0):
		return 'NO'
	print('YES')
	return '1 ' * (k - 1) + str(n - k + 1)

def even():
	if 2 * k > n:
		return 'NO'
	print('YES')
	return '2 ' * (k - 1) + str(n - 2 * (k - 1))
for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	if k > n:
		print('NO')
	elif n % 2 != 0:
		print(odd())
	elif k % 2 != 0:
		print(even())
	elif 2 * k > n:
		print(odd())
	else:
		print(even())


ipnl = lambda n: [int(input()) for _ in range(n)]
inp = lambda : int(input())
ip = lambda : [int(w) for w in input().split()]
mp = lambda : map(int, input().split())
for _ in range(int(input())):
	(n, k) = mp()
	t = []
	if n % 2 == 1:
		if k % 2:
			for i in range(k - 1):
				t.append(1)
			tt = n - sum(t)
			if tt > 0 and tt % 2 == 1:
				t.append(tt)
			else:
				print('NO')
				continue
		else:
			for i in range(k - 1):
				t.append(2)
			tt = n - sum(t)
			if tt > 0 and tt % 2 == 0:
				t.append(tt)
			else:
				print('NO')
				continue
	elif k % 2:
		for i in range(k - 1):
			t.append(2)
		tt = n - sum(t)
		if tt > 0 and tt % 2 == 0:
			t.append(tt)
		else:
			print('NO')
			continue
	else:
		for i in range(k - 1):
			t.append(1)
		tt = n - sum(t)
		if tt > 0 and tt % 2 == 1:
			t.append(tt)
		else:
			print('NO')
			continue
	print('YES')
	print(*t)


import sys
import bisect
import heapq
from math import *
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
mod = pow(10, 9) + 7

def inp():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def graph(vertex):
	return [[] for i in range(0, vertex + 1)]

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def dfs(v, visited, st, new, cnt):
	print(cnt, st)
	new.append(st)
	visited[st] = 1
	for i in v[st]:
		if visited[i] == 0:
			dfs(v, visited, i, new, cnt)
		else:
			cnt[0] += 1

def solve():
	(n, k) = sep()
	arr = []
	if n % 2 == 0:
		if k > n // 2:
			if k > n or k % 2 == 1:
				print('NO')
			else:
				print('YES')
				for i in range(0, k - 1):
					arr.append(1)
				arr.append(n - (k - 1))
				print(*arr)
		else:
			print('YES')
			for i in range(0, k - 1):
				arr.append(2)
			arr.append(n - 2 * (k - 1))
			print(*arr)
	elif k % 2 == 0 or k > n:
		print('NO')
	else:
		print('YES')
		for i in range(0, k - 1):
			arr.append(1)
		arr.append(n - (k - 1))
		print(*arr)
testcase(int(inp()))


def solution(n, k):
	for incr in [1, 2]:
		temp = n - (k - 1) * incr
		if temp > 0 and temp % 2 == incr % 2:
			print('YES')
			print(' '.join([str(temp)] + (k - 1) * [str(incr)]))
			return
	print('NO')
t = int(input())
for i in range(1, t + 1):
	(n, k) = map(int, input().split(' '))
	solution(n, k)


def func(n, k):
	if n % 2 == 0:
		if n >= 2 * k:
			print('YES')
			print('2 ' * (k - 1), end='')
			print(n - 2 * (k - 1))
		elif k % 2 != 0:
			print('NO')
		elif n < k:
			print('NO')
		else:
			print('YES')
			print('1 ' * (k - 1), end='')
			print(n - (k - 1))
	elif n < k or k % 2 == 0:
		print('NO')
	else:
		print('YES')
		print('1 ' * (k - 1), end='')
		print(n - (k - 1))
for q in range(int(input())):
	(n, k) = list(map(int, input().split()))
	func(n, k)


from collections import defaultdict

def solve():
	(n, k) = map(int, input().split())
	l = []
	if n > k - 1 and (n - (k - 1)) % 2 == 1:
		l = l + [1] * (k - 1)
		l = l + [n - (k - 1)]
		print('YES')
		print(*l)
	elif n > 2 * k - 2 and (n - (2 * k - 2)) % 2 == 0:
		l = l + [2] * (k - 1)
		l = l + [n - (2 * k - 2)]
		print('YES')
		print(*l)
	else:
		print('NO')
for _ in range(int(input())):
	solve()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n == 0 or k == 0:
		print('NO')
		continue
	if n < k:
		print('NO')
		continue
	if n == k:
		print('YES')
		for i in range(n):
			print(1, end=' ')
		print()
		continue
	n_even = n % 2 == 0
	k_even = k % 2 == 0
	n_odd = n % 2 == 1
	k_odd = k % 2 == 1
	if n_odd and k_odd:
		Sum = 0
		print('YES')
		for x in range(k - 1):
			Sum += 1
			print(1, end=' ')
		print(n - Sum)
		continue
	if n_even and k_odd:
		if 2 * (k - 1) >= n - 1:
			print('NO')
		else:
			print('YES')
			Sum = 0
			for x in range(k - 1):
				print(2, end=' ')
				Sum += 2
			print(n - Sum)
		continue
	if n_odd and k_even:
		print('NO')
		continue
	if n_even and k_even:
		print('YES')
		Sum = 0
		for x in range(k - 1):
			print(1, end=' ')
			Sum += 1
		print(n - Sum)
		continue


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
	elif n % 2 != 0:
		if k % 2 == 0:
			print('NO')
		else:
			print('YES')
			b = [1 for i in range(k - 1)]
			b.append(n - k + 1)
			print(*b)
	elif k <= n / 2:
		print('YES')
		b = [2 for i in range(k - 1)]
		b.append(n - 2 * k + 2)
		print(*b)
	elif n % k % 2 == 0:
		print('YES')
		b = [1 for i in range(k - 1)]
		b.append(n - k + 1)
		print(*b)
	else:
		print('NO')


import sys
input = lambda : sys.stdin.readline().rstrip()

def pin(type=int):
	return map(type, input().split())

def tupin(t=int):
	return tuple(pin(t))

def resolve():
	N = int(input())
	for n in range(N):
		(n, k) = pin()
		if k % 2 == 0:
			if n % 2 != 0 or k > n:
				print('NO')
				continue
			ans = [1] * k
			ans[0] = 1 + n - k
		elif n % 2 == 0:
			ans = [2] * k
			if sum(ans) > n:
				print('NO')
				continue
			ans[0] += n - k * 2
		else:
			ans = [1] * k
			if sum(ans) > n:
				print('NO')
				continue
			ans[0] = 1 + n - k
		print('YES')
		print(*ans)
resolve()


from os import error
import sys
input = sys.stdin.readline
DEBUG = False

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def run(s, c, v):
	_s = s - (c - 1) * v
	if _s <= 0:
		return None
	if _s % 2 != v % 2:
		return None
	ans = [v] * (c - 1)
	ans.append(_s)
	return ans

def solve():
	(s, c) = inlt()
	ans = run(s, c, 1)
	if ans:
		return ans
	ans = run(s, c, 2)
	return ans
n = inp()
for t in range(n):
	ans = solve()
	if ans:
		print('YES')
		print(' '.join([str(v) for v in ans]))
	else:
		print('NO')


def main():
	t = int(input())
	for i in range(t):
		(n, k) = list(map(int, input().split()))
		Parity(n, k)

def Parity(n, k):
	if n < k:
		print('NO')
		return
	if n % 2 != 0 and k % 2 == 0:
		print('NO')
		return
	if k == 1:
		print('YES')
		print(n)
		return
	l = []
	for j in range(n - 1, 0, -1):
		if j % 2 == 0:
			if j + (k - 1) * 2 == n:
				print('YES')
				print(j, '2 ' * (k - 1))
				return
		elif j + (k - 1) * 1 == n:
			print('YES')
			print(j, '1 ' * (k - 1))
			return
	print('NO')
main()


def read_int():
	n = int(input())
	return n

def read_ints():
	ints = [int(x) for x in input().split(' ')]
	return ints

def solve(n, k):
	if k > n:
		return 'NO'
	n1 = 1
	nums = [n1] * (k - 1)
	n2 = n - sum(nums)
	if n2 % 2 == 1 and n2 > 0:
		nums.append(n2)
		return [str(x) for x in nums]
	n1 = 2
	nums = [n1] * (k - 1)
	n2 = n - sum(nums)
	if n2 % 2 == 0 and n2 > 0:
		nums.append(n2)
		return [str(x) for x in nums]
	return 'NO'
t = read_int()
for case in range(t):
	(n, k) = read_ints()
	sol = solve(n, k)
	if sol == 'NO':
		print(sol)
	else:
		print('YES')
		print(' '.join(sol))


import sys
import math as mt
t = int(input())
for __ in range(t):
	(n, k) = map(int, input().split())
	(o, e) = (0, 0)
	(lo, le) = (1, 2)
	if n >= k and (n - (k - 1)) % 2 != 0:
		lo = n - (k - 1)
		o = 1
	if n >= 2 * k and (n - 2 * (k - 1)) % 2 == 0:
		e = 1
		le = n - 2 * (k - 1)
	if o == 1:
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(lo)
	elif e == 1:
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		print(le)
	else:
		print('NO')


import math
t = int(input())
while t:
	(a, b) = list(map(int, input().split()))
	s = ''
	if a >= b:
		if a % 2 == 0:
			if b <= a // 2 and b % 2 == 1:
				print('YES')
				s = s + '2 ' * (b - 1)
				s = s + str(a - 2 * (b - 1))
				print(s)
			elif b % 2 == 0:
				print('YES')
				s = s + '1 ' * (b - 1)
				s = s + str(a - (b - 1))
				print(s)
			else:
				print('NO')
		elif a % 2 == 1 and b % 2 == 1:
			print('YES')
			s = s + '1 ' * (b - 1)
			s = s + str(a - (b - 1))
			print(s)
		else:
			print('NO')
	else:
		print('NO')
	t = t - 1


mod = int(1000000000.0) + 7

def ip():
	return int(input())

def Ip():
	return map(int, input().split())
for _ in range(0, int(input())):
	(n, k) = Ip()
	l = []
	if n < k:
		print('NO')
	elif n % 2 == 1:
		if k % 2 == 0:
			print('NO')
		else:
			print('YES')
			for i in range(0, k - 1):
				print(1, end=' ')
			print(n - k + 1, end=' ')
			print()
	elif k % 2 == 0:
		print('YES')
		for i in range(0, k - 1):
			print(1, end=' ')
		print(n - k + 1, end=' ')
		print()
	elif n < 2 * k:
		print('NO')
	else:
		print('YES')
		for i in range(0, k - 1):
			print(2, end=' ')
		print(n - 2 * (k - 1), end=' ')
		print()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	n1 = n
	n2 = n
	flag = True
	if k == 1:
		print('YES')
		print(n)
		continue
	n1 = n - (k - 1)
	if n1 > 0 and n1 % 2 != 0:
		print('YES')
		print('1 ' * (k - 1), n1)
		continue
	n2 = n - (k - 1) * 2
	if n2 > 0 and n2 % 2 == 0:
		print('YES')
		print('2 ' * (k - 1), n2)
		continue
	if flag:
		print('NO')


from fractions import Fraction
import bisect
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())
mod = int(1000000000.0) + 7

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
t = 1
t = iinput()
for _ in range(t):
	(n, k) = rinput()
	if k > n:
		print('NO')
	elif (n - k + 1) % 2:
		print('YES')
		print('1 ' * (k - 1) + str(n - k + 1))
	elif n - 2 * k + 2 > 0 and (n - 2 * k + 2) % 2 == 0:
		print('YES')
		print('2 ' * (k - 1) + str(n - 2 * k + 2))
	else:
		print('NO')


n = int(input())
for i in range(0, n):
	o = input().rstrip().split(' ')
	a = int(o[0])
	b = int(o[1])
	if a == b:
		print('YES')
		print('1 ' * b)
	elif a % 2 == 0:
		D = a // 2
		if b > D:
			if b > a or b % 2 != 0:
				print('NO')
			else:
				print('YES')
				for j in range(0, b - 1):
					print('1', end=' ')
				print(a - (b - 1))
		else:
			print('YES')
			for j in range(0, b - 1):
				print('2', end=' ')
			print(a - 2 * (b - 1))
	elif b > a or b % 2 == 0:
		print('NO')
	else:
		print('YES')
		for j in range(0, b - 1):
			print('1', end=' ')
		print(a - (b - 1))


import sys

def read_int():
	return int(sys.stdin.readline())

def read_ints():
	return list(map(int, sys.stdin.readline().split()))
t = read_int()
for j in range(t):
	(n, k) = read_ints()
	if n < k:
		print('NO')
		continue
	chastnoe = n // k
	ostatok = n % k
	lst = [chastnoe] * k
	if ostatok == 0:
		print('YES')
		print(*lst)
	elif ostatok % 2 == 0:
		for j in range(int(ostatok / 2)):
			lst[j] += 2
		print('YES')
		print(*lst)
	elif (k - ostatok) % 2 == 0 and chastnoe > 1:
		for j in range(len(lst)):
			if j >= k - ostatok or j % 2:
				lst[j] += 1
			else:
				lst[j] -= 1
		print('YES')
		print(*lst)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	rem1 = n - k + 1
	rem2 = n - (k - 1) * 2
	if rem1 > 0 and rem1 % 2 == 1:
		print('YES')
		ones = [1 for i in range(k - 1)] + [rem1]
		print(' '.join(map(str, ones)))
	elif rem2 > 0 and rem2 % 2 == 0:
		print('YES')
		twos = [2 for i in range(k - 1)] + [rem2]
		print(' '.join(map(str, twos)))
	else:
		print('NO')


def parity(n, k):
	a = n - (k - 1)
	b = n - 2 * (k - 1)
	if a > 0 and a % 2 == 1:
		print('yes')
		s = str(a)
		for i in range(k - 1):
			s = s + ' ' + '1'
		print(s)
		return
	elif b > 0 and b % 2 == 0:
		print('yes')
		s = str(b)
		for i in range(k - 1):
			s = s + ' ' + '2'
		print(s)
		return
	else:
		print('No')
t = int(input())
for i in range(t):
	T = input()
	l = list(map(int, T.split()))
	parity(l[0], l[1])


t = int(input())
for kek in range(t):
	(n, k) = map(int, input().split())
	if n % 2 == 0:
		if n < 2 * k:
			pass
		else:
			print('YES')
			print('2 ' * (k - 1), n - 2 * (k - 1), sep='')
			continue
	if n < k:
		pass
	elif (n - (k - 1)) % 2 == 1:
		print('YES')
		print('1 ' * (k - 1), n - (k - 1), sep='')
		continue
	print('NO')


for _ in range(int(input())):
	(a, k) = map(int, input().split())
	arr = []
	c = 0
	if a % 2 == 0:
		if k % 2 == 0:
			if k <= a:
				c = 1
				arr = [1] * (k - 1)
				arr.append(a - (k - 1))
		elif 2 * k <= a and (a - 2 * (k - 1)) % 2 == 0:
			c = 1
			arr = [2] * (k - 1)
			arr.append(a - 2 * (k - 1))
	elif a % 2 != 0:
		if k % 2 != 0:
			if k <= a:
				c = 1
				arr = [1] * (k - 1)
				arr.append(a - (k - 1))
	if c == 0:
		print('NO')
	else:
		print('YES')
		print(*arr)


def check_odd(n, k):
	initial_sum = 1 * k
	last_number = 1 + (n - initial_sum)
	if last_number % 2 != 0 and last_number > 0:
		return True
	else:
		return False

def check_even(n, k):
	initial_sum = 2 * k
	last_number = 2 + (n - initial_sum)
	if last_number % 2 == 0 and last_number > 0:
		return True
	else:
		return False
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n % 2 != 0 and k % 2 == 0 or k > n:
		print('no')
		continue
	if n % k == 0:
		print('yes')
		s = str(n // k)
		print('{} '.format(s) * k)
		continue
	if check_even(n, k):
		print('yes')
		print('2 ' * (k - 1), end='')
		last_number = 2 + (n - 2 * k)
		print(last_number)
	elif check_odd(n, k):
		print('yes')
		print('1 ' * (k - 1), end='')
		last_number = 1 + (n - 1 * k)
		print(last_number)
	else:
		print('no')


for t in range(int(input())):
	(nm1, nm2) = map(int, input().split())
	if nm1 % 2 == 0:
		if nm1 - 2 * nm2 + 2 > 0:
			print('YES')
			ar = [2] * (nm2 - 1)
			print(nm1 - 2 * nm2 + 2, *ar)
			continue
	if nm1 - nm2 + 1 > 0 and (nm1 - nm2) % 2 == 0:
		print('YES')
		ar = [1] * (nm2 - 1)
		print(nm1 - nm2 + 1, *ar)
		continue
	print('NO')


for t in range(int(input())):
	(n, k) = map(int, input().split(' '))
	tmp_ev = n - 2 * (k - 1)
	tmp_odd = n - (k - 1)
	if tmp_ev % 2 == 0 and tmp_ev > 0:
		print('YES')
		out = (k - 1) * '2 ' + '{} '.format(tmp_ev)
		print(out)
	elif tmp_odd % 2 != 0 and tmp_odd > 0:
		print('YES')
		out = (k - 1) * '1 ' + '{} '.format(tmp_odd)
		print(out)
	else:
		print('NO')


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	n = []
	if b > a:
		print('NO')
	elif a % 2 == 0:
		if b <= a // 2:
			x = int(0)
			while x < b:
				if x == b - 1:
					n.append(a - 2 * (b - 1))
				else:
					n.append(2)
				x = x + 1
			print('YES')
			print(*n)
		elif b % 2 == 0:
			x = int(0)
			while x < b:
				if x == b - 1:
					n.append(a - (b - 1))
				else:
					n.append(1)
				x = x + 1
			print('YES')
			print(*n)
		else:
			print('NO')
	elif b % 2 == 0:
		print('NO')
	else:
		x = int(0)
		while x < b:
			if x == b - 1:
				n.append(a - b + 1)
			else:
				n.append(1)
			x = x + 1
		print('YES')
		print(*n)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	(val_1, val_2) = (1, 2)
	(final_1, final_2) = ([val_1] * (k - 1), [val_2] * (k - 1))
	final_1.append(n - val_1 * (k - 1))
	final_2.append(n - val_2 * (k - 1))
	if final_1[-1] > 0 and final_1[-1] % 2 == 1:
		print('YES')
		for item in final_1:
			print(item, end=' ')
		print()
	elif final_2[-1] > 0 and final_2[-1] % 2 == 0:
		print('YES')
		for item in final_2:
			print(item, end=' ')
		print()
	else:
		print('NO')


t = int(input())
for _ in range(0, t):
	(a, k) = map(int, input().split())
	g = a
	f = 1
	f1 = 0
	f2 = 0
	ans = []
	if a % 2 == 0 and k % 2 == 1:
		a = a - (k - 1) * 2
		if a <= 0:
			f = 0
		else:
			ans.extend([2] * (k - 1))
			ans.append(a)
	elif a % 2 == 1 and k % 2 == 1:
		a = a - (k - 1) * 1
		if a <= 0:
			f = 0
		else:
			ans.extend([1] * (k - 1))
			ans.append(a)
	elif a % 2 == 0 and k % 2 == 0:
		a = a - (k - 1) * 2
		if a <= 0 or a % 2 == 1:
			f = 0
		else:
			f2 = 1
			ans.extend([2] * (k - 1))
			ans.append(a)
		a = g
		a = a - (k - 1) * 1
		if a <= 0 or a % 2 == 0:
			f = 0
		elif f2 == 0:
			f1 = 1
			ans.extend([1] * (k - 1))
			ans.append(a)
	elif a % 2 == 1 and k % 2 == 0:
		a = a - (k - 1) * 1
		if a <= 0 or a % 2 == 0:
			f = 0
		else:
			ans.extend([1] * (k - 1))
			ans.append(a)
	if f1 or f2 or f:
		print('YES')
		print(*ans)
	else:
		print('NO')


import math
import os
import random
import re
import sys

def printarr(arr):
	for z in arr:
		if type(z) is list:
			for k in z:
				print(k, end=' ')
		else:
			print(z, end=' ')
	print(end='\n')

def solve(n, k):
	if n < k:
		print('NO')
	else:
		div = int(n / k)
		rem = n % k
		if (rem + div) % 2 == 1 and div % 2 == 1:
			print('YES')
			for i in range(k - 1):
				print(div, end=' ')
			print(div + rem)
		elif (rem + div) % 2 == 0 and div % 2 == 0:
			print('YES')
			for i in range(k - 1):
				print(div, end=' ')
			print(div + rem)
		elif (k - 1) % 2 != 0 or div == 1:
			print('NO')
		else:
			print('YES')
			for i in range(int(k / 2)):
				print(div + 1, div - 1, end=' ')
			print(div + rem)
t = int(input())
while t > 0:
	ins = list(input().split())
	n = int(ins[0])
	k = int(ins[1])
	t -= 1
	solve(n, k)


import math
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n & 1 and k % 2 == 0:
		print('NO')
	elif n % k == 0:
		print('YES')
		d = n // k
		x = [d] * k
		print(*x)
	else:
		d = [1] * (k - 1)
		s1 = n - sum(d)
		if s1 & 1 and s1 > 0:
			d.append(s1)
			print('YES')
			print(*d)
		else:
			x = [2] * (k - 1)
			s2 = n - sum(x)
			if s2 & 1 != 1 and s2 > 0:
				x.append(s2)
				print('YES')
				print(*x)
			else:
				print('NO')


import math
import sys
from collections import defaultdict, Counter, deque, OrderedDict
import bisect
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]
from itertools import accumulate, groupby
import sys
for _ in range(int(input())):
	(n, k) = ilele()
	a = 2 * (k - 1)
	b = 1 * (k - 1)
	c = n - a
	d = n - b
	if c > 0 and c % 2 == 0:
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		print(c, end=' ')
		print()
	elif d > 0 and d % 2 != 0:
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(d, end=' ')
		print()
	else:
		print('NO')


t = int(input())
for _ in range(t):
	d = []
	(n, k) = map(int, input().split())
	if (n - k + 1) % 2 != 0 and n - k + 1 > 0:
		print('YES')
		for i in range(k - 1):
			d.append(1)
		d.append(n - k + 1)
		print(' '.join((str(x) for x in d)))
	elif (n - 2 * (k - 1)) % 2 == 0 and n - 2 * (k - 1) > 0:
		print('YES')
		for i in range(k - 1):
			d.append(2)
		d.append(n - 2 * (k - 1))
		print(' '.join((str(x) for x in d)))
	else:
		print('NO')


N = int(input())
for _ in range(N):
	(x, y) = map(int, input().split())
	l = []
	if y > x:
		print('NO')
	elif x % y == 0:
		ans = x // y
		print('YES')
		for i in range(y):
			l.append(ans)
		print(*l)
	elif x % 2 == 0 and y % 2 == 0:
		print('YES')
		for i in range(y - 1):
			l.append('1')
		l.append(str(x - y + 1))
		print(*l)
	elif x % 2 != 0 and y % 2 != 0:
		print('YES')
		for i in range(y - 1):
			l.append('1')
		l.append(str(x - y + 1))
		print(*l)
	elif x % 2 == 0 and y % 2 != 0:
		if x >= 2 * y:
			print('YES')
			for i in range(y - 1):
				l.append('2')
			l.append(str(x - 2 * (y - 1)))
			print(*l)
		else:
			print('NO')
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	rem = n % k
	ans = None
	if not rem:
		ans = [n // k] * k
	elif rem % 2 == 0:
		ans = [n // k] * k
		ans[0] += rem
	elif rem % 2 != 0 and k % 2 != 0:
		ans = [n // k] * k
		for i in range(len(ans)):
			rem += 1
			ans[i] -= 1
		ans[0] += rem
	if ans and (not ans.count(0)) and (ans[-1] > 0):
		print('YES')
		print(*ans)
	else:
		print('NO')


import math

def ans(a, b):
	x = a
	y = b
	sum = 0
	count = 0
	s = ''
	s1 = ''
	if a % b == 0:
		print('YES')
		for i in range(1, b + 1, 1):
			print(a // b, end=' ')
		print()
	elif a % 2 == 0:
		for i in range(1, b, 1):
			s += '2'
			s += ' '
			sum += 2
		s += str(abs(a - sum))
		m = sum + abs(a - sum)
		for i in range(1, b, 1):
			s1 += '1'
			s1 += ' '
			count += 1
		s1 += str(abs(a - count))
		n = count + abs(count - a)
		if m == x and abs(a - sum) > 0 and (abs(a - sum) % 2 == 0):
			print('YES')
			print(s)
		elif n == x and abs(count - a) > 0 and (abs(a - count) % 2 != 0):
			print('YES')
			print(s1)
		else:
			print('NO')
	elif a % 2 != 0:
		for i in range(1, b, 1):
			s += '2'
			s += ' '
			sum += 2
		s += str(abs(a - sum))
		m = sum + abs(a - sum)
		for i in range(1, b, 1):
			s1 += '1'
			s1 += ' '
			count += 1
		s1 += str(abs(a - count))
		n = count + abs(count - a)
		if m == x and abs(a - sum) > 0 and (abs(a - sum) % 2 == 0):
			print('YES')
			print(s)
		elif n == x and abs(count - a) > 0 and (abs(a - count) % 2 != 0):
			print('YES')
			print(s1)
		else:
			print('NO')
	else:
		print('NO')
t = int(input())
f = 0
while t > 0:
	sum = 0
	(a, b) = map(int, input().split())
	if a < b:
		print('NO')
	else:
		ans(a, b)
	t -= 1


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	if k == 1:
		print('yes')
		print(n)
	elif n == k:
		print('yes')
		print('{} '.format(1) * k)
	elif k > n and k != 1 or (n % 2 == 1 and k % 2 == 0) or n - k == 1:
		print('no')
	elif n % 2 == 1 and k % 2 == 1:
		print('yes')
		print('{} '.format(1) * (k - 1) + '{} '.format(n - k + 1))
	elif n % 2 == 0 and k % 2 == 1:
		x = 2
		if n // k == 1:
			print('no')
		else:
			print('yes')
			print('{} '.format(x) * (k - 1) + '{} '.format(n - x * (k - 1)))
	else:
		print('yes')
		x = 1
		print('{} '.format(x) * (k - 1) + '{} '.format(n - x * (k - 1)))


for _ in range(int(input())):
	(N, K) = map(int, input().split())
	X = 2 if N % 2 == 0 and K % 2 == 1 else 1
	L = [X] * (K - 1)
	C = N - sum(L)
	if C > 0 and C % 2 == X % 2:
		print('YES')
		print(*L, C)
	else:
		print('NO')


n = int(input())
k = []
m = []
for i in range(n):
	(a, b) = input().split()
	k.append(int(a))
	m.append(int(b))
for s in range(n):
	if k[s] % 2 == 0 and m[s] % 2 != 0:
		if m[s] * 2 <= k[s]:
			print('YES')
			for l in range(m[s] - 1):
				print(2, end=' ')
			print(k[s] - 2 * (m[s] - 1))
		else:
			print('NO')
	elif k[s] % 2 == 0 and m[s] % 2 == 0:
		if m[s] <= k[s]:
			print('YES')
			for l in range(m[s] - 1):
				print(1, end=' ')
			print(k[s] - m[s] + 1)
		else:
			print('NO')
	elif k[s] % 2 != 0 and m[s] % 2 == 0:
		print('NO')
	elif k[s] % 2 != 0 and m[s] % 2 != 0:
		if m[s] <= k[s]:
			print('YES')
			for l in range(m[s] - 1):
				print(1, end=' ')
			print(k[s] - m[s] + 1)
		else:
			print('NO')


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	(n, k) = map(int, sys.stdin.readline().split())
	f = n // k
	arr = []
	temp = 0
	judge = True
	if f == 0:
		print('NO')
		continue
	if n == 1 and k == 1:
		print('YES')
		print(1)
		continue
	if k == 1:
		print('YES')
		print(n)
		continue
	for i in range(k):
		if i == k - 1:
			if (arr[-1] + (n - sum(arr))) % 2 == 1:
				judge = False
			else:
				arr.append(n - sum(arr))
		else:
			arr.append(f)
	if judge == True:
		print('YES')
		for k in range(len(arr)):
			if k == len(arr) - 1:
				print(arr[k])
			else:
				print(arr[k], end=' ')
	else:
		f -= 1
		arr = []
		temp = 0
		if f == 0:
			print('NO')
		else:
			for j in range(k):
				if j == k - 1:
					if (arr[-1] + (n - sum(arr))) % 2 != 1:
						judge = True
						arr.append(n - sum(arr))
					else:
						pass
				else:
					arr.append(f)
			if judge == False:
				print('NO')
			else:
				print('YES')
				for l in range(len(arr)):
					if l == len(arr) - 1:
						print(arr[l])
					else:
						print(arr[l], end=' ')


t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	if n % 2 == k % 2 and n >= k:
		print('YES')
		out = [1] * k
		out[0] += n - k
		print(*out)
	elif n % 2 == 0 and n >= 2 * k:
		print('YES')
		out = [2] * k
		out[0] += n - 2 * k
		print(*out)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	if n == 2 and k == 1:
		print('YES')
		print('2')
	elif n < k or n - k == 1 or (n % 2 == 1 and k % 2 == 0):
		print('NO')
	elif n == k:
		print('YES')
		print('1 ' * k)
	elif n % k == 0:
		print('YES')
		print(k * (str(n // k) + ' '))
	elif n % 2 == 0 and k % 2 == 1:
		(a, v) = ([], 2)
		while k > 1:
			a.append(2)
			n = n - 2
			k -= 1
		a.append(n)
		f = True
		for i in range(len(a)):
			if a[i] < 1:
				print('NO')
				f = False
				break
		if f == True:
			print('YES')
			print(*a)
	else:
		(a, v) = ([], 1)
		while k > 1:
			a.append(1)
			n = n - 1
			k -= 1
		a.append(n)
		f = True
		for i in range(len(a)):
			if a[i] < 1:
				print('NO')
				f = False
				break
		if f == True:
			print('YES')
			print(*a)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n % 2 == k % 2:
		if n >= k:
			print('YES')
			print('1 ' * (k - 1) + str(n - k + 1))
		else:
			print('NO')
	elif n % 2 == 0 and k % 2 == 1:
		if n >= k * 2:
			print('YES')
			print('2 ' * (k - 1) + str(n - 2 * k + 2))
		else:
			print('NO')
	elif n % 2 == 1 and k % 2 == 0:
		print('NO')
	else:
		raise RuntimeError('inv')


t = int(input())
a = []
for i in range(t):
	n = str(input())
	a.append(n)
for i in a:
	b = i.split(' ')
	n = int(b[0])
	k = int(b[1])
	c = []
	d = n - (k - 1)
	if d > 0 and d % 2 != 0:
		print('YES')
		c.append(d)
		for j in range(k - 1):
			c.append(1)
		print(' '.join(map(str, c)))
		continue
	d1 = n - 2 * (k - 1)
	if d1 > 0 and d1 % 2 == 0:
		print('YES')
		c.append(d1)
		for j in range(k - 1):
			c.append(2)
		print(' '.join(map(str, c)))
		continue
	print('NO')


from math import *
from bisect import bisect_left, bisect_right
from queue import Queue
from sys import stdin, stdout
from collections import Counter
input = lambda : stdin.readline().strip()
fast_print = stdout.write
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	if n % 2 == 0 and (2 * k <= n or (k % 2 == 0 and k <= n)) or (n % 2 == 1 and k % 2 == 1 and (k <= n)):
		fast_print('YES\n')
		if k % 2 == 0 and k <= n:
			for i in range(k - 1):
				fast_print('1 ')
			fast_print(str(n - k + 1))
		else:
			for i in range(k - 1):
				fast_print('2 ') if n % 2 == 0 else fast_print('1 ')
			if n % 2 == 0:
				fast_print(str(n - 2 * (k - 1)))
			else:
				fast_print(str(n - k + 1))
		fast_print('\n')
	else:
		fast_print('NO\n')


for i in range(int(input())):
	(a, b) = map(int, input().split())
	c = a // b
	l = []
	rem = a // 2
	if a % 2 == 1 and b % 2 == 0 or b > a or ((a % 2 == 0 and b % 2 == 1) and b > rem):
		print('NO')
	else:
		d = c * (b - 1)
		e = a - d
		while c % 2 != 0 and e % 2 == 0 or (c % 2 == 0 and e % 2 != 0):
			c -= 1
			d = c * (b - 1)
			e = a - d
		if d > 0:
			print('YES')
			for j in range(b - 1):
				l.append(c)
			l.append(e)
			for j in range(len(l)):
				if j == len(l) - 1:
					print(l[j])
				else:
					print(l[j], end=' ')
		elif d == 0:
			print('YES')
			l.append(e)
			for j in range(len(l)):
				if j == len(l) - 1:
					print(l[j])
				else:
					print(l[j], end=' ')
		else:
			print('NO')


cases = int(input())
for t in range(cases):
	(n, k) = list(map(int, input().split()))
	ones = k - 1
	left = n - (k - 1)
	f = 0
	if left < 1:
		print('NO')
	elif left % 2 != 0:
		f = 1
		s = [1] * ones + [left]
	elif (k - 1) % 2 == 0 and left - (k - 1) > 0:
		f = 1
		s = [2] * ones + [left - (k - 1)]
	else:
		print('NO')
	if f == 1:
		print('YES')
		print(*s)


def f(n, k):
	if n < k:
		return -1
	if n % 2 == 1 and k % 2 == 0:
		return -1
	if n % 2 == 0 and k % 2 == 1 and (n < 2 * k):
		return -1
	return 0
t = int(input())
cnt = 0
while cnt < t:
	cnt += 1
	(n, k) = [int(i) for i in input().split()]
	if f(n, k) == -1:
		print('NO')
	elif n % 2 == 1 or (n % 2 == 0 and k % 2 == 0):
		print('YES')
		print('{} '.format(str(1)) * (k - 1) + str(n - k + 1), end='')
	elif n % 2 == 0 and k % 2 == 1:
		print('YES')
		print('{} '.format(str(2)) * (k - 1) + str(n - 2 * k + 2), end='')
	print()


t = int(input())
for _ in range(t):
	(n, k) = tuple([int(i) for i in input().split()])
	if k % 2 == 0 and n % 2 == 1:
		print('NO')
		continue
	if n < k:
		print('NO')
		continue
	guess = n // k
	rem = n % k
	if rem % 2 == 0:
		print('YES')
		print((str(guess) + ' ') * (k - 1) + str(guess + rem))
	elif rem % 2 == 1 and k % 2 == 1:
		rem += k
		guess -= 1
		if guess == 0:
			print('NO')
		else:
			print('YES')
			print((str(guess) + ' ') * (k - 1) + str(guess + rem))


def main():
	import sys, math
	from heapq import heapify, heappush, heappop
	from collections import defaultdict as dd, deque

	def data():
		return sys.stdin.readline().strip()

	def mdata():
		return list(map(int, data().split()))

	def out(*var, end='\n'):
		sys.stdout.write(' '.join(map(str, var)) + end)
	INF = int(1000000000.0)
	mod = int(1000000000.0) + 7
	for t in range(int(data())):
		(n, k) = mdata()
		if n < k:
			print('NO')
			continue
		if (n + k) % 2 != 0:
			if (k - 1) * 2 >= n or (n % 2 != 0 and k % 2 == 0):
				print('NO')
			else:
				ans = [2] * (k - 1)
				ans.append(n - 2 * (k - 1))
				print('YES')
				print(*ans)
		else:
			ans = [1] * (k - 1)
			ans.append(n - k + 1)
			print('YES')
			print(*ans)
main()


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	if k == 1:
		print('YES')
		print(n)
		continue
	num1 = n
	num2 = n
	pl = 0
	num1 = num1 - (k - 1) * 1
	if num1 <= 0:
		print('NO')
		pl = 1
	elif num1 % 2 == 1:
		ll = [1] * (k - 1) + [num1]
		print('YES')
		print(*ll)
		pl = 1
	if pl == 0:
		num2 = num2 - (k - 1) * 2
		if num2 <= 0:
			print('NO')
			pl = 1
		elif num2 % 2 == 0:
			ll = [2] * (k - 1) + [num2]
			print('YES')
			print(*ll)
			pl = 1
	if pl == 0:
		print('NO')


import math
from collections import defaultdict
ml = lambda : map(int, input().split())
ll = lambda : list(map(int, input().split()))
ii = lambda : int(input())
ip = lambda : input()
t = ii()
for _ in range(t):
	(a, b) = ml()
	if a // b < 1 or (a & 1 == 1 and b & 1 == 0) or (a & 1 == 0 and b & 1 == 1 and (a < b * 2)):
		print('NO')
	else:
		print('YES')
		mul = 1
		if a % 2 == 0 and b % 2 == 0 and (a >= b * 2) or (a & 1 == 0 and b & 1):
			mul *= 2
		print(a - (b - 1) * mul, end=' ')
		for i in range(b - 1):
			print(1 * mul, end=' ')
		print()


class answer:

	def __init__(self, flag, arr=[]):
		self.flag = flag
		self.arr = arr

def solve(n, k):
	if k % 2 == 0 and n % 2 == 0:
		if n >= k:
			ans = answer(True, [1] * (k - 1) + [n - k + 1])
		else:
			ans = answer(False, [])
	elif k % 2 == 1 and n % 2 == 0:
		if n >= 2 * k:
			ans = answer(True, [2] * (k - 1) + [n - 2 * (k - 1)])
		else:
			ans = answer(False, [])
	elif k % 2 == 1 and n % 2 == 1:
		if n >= k:
			ans = answer(True, [1] * (k - 1) + [n - k + 1])
		else:
			ans = answer(False, [])
	else:
		ans = answer(False, [])
	return ans
t = int(input())
for i in range(t):
	input_nums = input().split(' ')
	obj = solve(int(input_nums[0]), int(input_nums[1]))
	if obj.flag == True:
		print('YES')
		print(' '.join((str(j) for j in obj.arr)))
	else:
		print('NO')


class A:

	def solve(self):
		t = int(input())
		for i in range(t):
			n = list(map(int, input()))
			round_numbers = list(map(lambda x: x[0] * 10 ** x[1], filter(lambda x: x[0] > 0, zip(n, reversed(list(range(len(n))))))))
			print(len(round_numbers))
			print(' '.join(map(str, round_numbers)))

class B:

	def solve(self):
		t = int(input())
		for p in range(t):
			in_list = list(map(int, input().split(' ')))
			(n, k) = (in_list[0], in_list[1])
			if k % 2 == 1:
				if n % 2 == 0:
					first_term = n - (k - 1) * 2
					if first_term <= 0:
						print('NO')
						continue
					print('YES')
					print(' '.join([str(first_term)] + ['2' for x in range(k - 1)]))
				else:
					first_term = n - (k - 1)
					if first_term <= 0:
						print('NO')
						continue
					print('YES')
					print(' '.join([str(first_term)] + ['1' for x in range(k - 1)]))
			elif n % 2 == 0:
				first_term = n - (k - 1)
				if first_term <= 0:
					print('NO')
					continue
				if first_term % 2 == 1:
					print('YES')
					print(' '.join([str(first_term)] + ['1' for x in range(k - 1)]))
					continue
				first_term = n - (k - 1) * 2
				if first_term <= 0:
					print('NO')
					continue
				if first_term % 2 == 0:
					print('YES')
					print(' '.join([str(first_term)] + ['2' for x in range(k - 1)]))
				else:
					print('NO')
			else:
				print('NO')
B().solve()


import sys
import math
from collections import Counter, defaultdict
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass

def takeInput():
	return [int(x) for x in input().strip().split()]
t = int(input())
while t != 0:
	t -= 1
	(n, k) = takeInput()
	if n % 2 != 0:
		if k % 2 == 0:
			print('NO')
		else:
			ans = []
			start = 1
			for i in range(k - 1):
				ans.append(start)
			rem = n - sum(ans)
			if rem > 0:
				ans.append(n - sum(ans))
				print('YES')
				print(*ans)
			else:
				print('NO')
	else:
		ans = []
		start = 2
		for i in range(k - 1):
			ans.append(start)
		rem = n - sum(ans)
		if rem > 0:
			ans.append(n - sum(ans))
			print('YES')
			print(*ans)
		else:
			start = 1
			ans = []
			for i in range(k - 1):
				ans.append(start)
			rem = n - sum(ans)
			if rem > 0 and rem % 2 != 0:
				ans.append(n - sum(ans))
				print('YES')
				print(*ans)
			else:
				print('NO')


for _ in range(int(input())):
	(n, k) = [int(x) for x in input().split()]
	if n % 2 == 0 and k % 2 == 0 or (n % 2 == 1 and k % 2 == 1):
		if n >= k:
			print('YES')
			for i in range(k - 1):
				print(1, end=' ')
			print(n - (k - 1))
		else:
			print('NO')
	elif n % 2 == 0 and k % 2 == 1 and (n >= k * 2):
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		print(n - (k - 1) * 2)
	else:
		print('NO')


t = int(input())
for test in range(t):
	(n, k) = map(int, input().split())
	s = 'YES'
	ar = []
	if n % 2 == 0 and k <= n // 2:
		for i in range(k - 1):
			ar.append(2)
		ar.append(n - 2 * k + 2)
		print(s)
		for x in ar:
			print(x, end=' ')
	elif k <= n and (n - k + 1) % 2 == 1:
		for i in range(k - 1):
			ar.append(1)
		ar.append(n - k + 1)
		print(s)
		for x in ar:
			print(x, end=' ')
	else:
		print('NO', end=' ')
	print()


t = int(input())
while t > 0:
	(n, k) = map(int, input().split())
	if n % 2 == 1 and k % 2 == 0 or k > n:
		print('NO')
	elif n % 2 == 0 and k % 2 == 1:
		if k * 2 > n:
			print('NO')
		else:
			print('YES')
			print('2 ' * (k - 1), end='')
			print(n - 2 * (k - 1))
	else:
		print('YES')
		print('1 ' * (k - 1), end='')
		print(n - k + 1)
	t -= 1


z = input
mod = 10 ** 9 + 7
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0:
			return 0
	return 1
for _ in range(int(z())):
	(n, k) = map(int, z().split())
	if k > n or (n % 2 == 1 and k % 2 == 0):
		print('NO')
		continue
	if n % 2 == 0 and k % 2 == 1:
		l = 2
	else:
		l = 1
	if l * k > n:
		print('NO')
		continue
	print('YES')
	least = l
	print(*[n - least * k + least] + [least] * (k - 1))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a < b:
		print('NO')
	elif a & 1 == 1 and b & 1 == 0:
		print('NO')
	elif a & 1 == 1 and b & 1 == 1 or (a & 1 == 0 and b & 1 == 0):
		print('YES')
		r = [1] * (b - 1)
		r.append(a - (b - 1))
		print(*r)
	elif a < 2 * b:
		print('NO')
	else:
		print('YES')
		r = [2] * (b - 1)
		r.append(a - 2 * (b - 1))
		print(*r)


T = int(input())
for i in range(T):
	(a, b) = map(int, input().split())
	pso = 1 * (b - 1)
	rso = a - pso
	if rso > 0 and rso % 2 == 1:
		print('YES')
		print('1 ' * (b - 1) + str(rso))
	else:
		pse = 2 * (b - 1)
		rse = a - pse
		if rse > 0 and rse % 2 == 0:
			print('YES')
			print('2 ' * (b - 1) + str(rse))
		else:
			print('NO')


import sys, os
from collections import defaultdict, deque
from math import ceil, floor
if sys.version_info[1] >= 5:
	from math import gcd
else:
	from fractions import gcd
sys.setrecursionlimit(10 ** 6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0

def main(given=sys.stdin.readline):
	input = lambda : given().rstrip()
	LMIIS = lambda : list(map(int, input().split()))
	II = lambda : int(input())
	MOD = 10 ** 9 + 7
	t = II()
	I = [0] * t
	for i in range(t):
		I[i] = map(int, input().split())
	for (n, k) in I:
		if n < k:
			print('NO')
		elif n % 2 == 0 and k <= n // 2:
			print('YES')
			ans = [2] * (k - 1)
			ans.append(2 * (n // 2 - k + 1))
			print(*ans)
		elif (n - k) % 2 == 0:
			print('YES')
			ans = [1] * (k - 1)
			ans.append(n - k + 1)
			print(*ans)
		else:
			print('NO')
main()


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
	else:
		arr = [1] * (k - 1)
		arr1 = [2] * (k - 1)
		diff = n - (k - 1)
		diff1 = n - 2 * (k - 1)
		if (diff + 1) % 2 == 0 and diff > 0:
			print('YES')
			arr.append(diff)
			print(*arr)
		elif (diff1 + 2) % 2 == 0 and diff1 > 0:
			print('YES')
			arr1.append(diff1)
			print(*arr1)
		else:
			print('NO')


def to_list(s):
	return list(map(lambda x: int(x), s.split(' ')))

def assemble(n, k):
	answer = []
	if k > n:
		return 'NO'
	else:
		if (n % 2 == 0) & (k % 2 == 1):
			if k > n / 2:
				return 'NO'
			else:
				for i in range(k - 1):
					answer.append(2)
				answer.append(n - (k - 1) * 2)
				return ' '.join(list(map(lambda x: str(x), answer)))
		if (n % 2 == 0) & (k % 2 == 0):
			if n / 2 > k:
				for i in range(k - 1):
					answer.append(2)
				answer.append(n - (k - 1) * 2)
				return ' '.join(list(map(lambda x: str(x), answer)))
			elif n / k == 1:
				return ' '.join([str(1) for i in range(n)])
			else:
				for i in range(k - 1):
					answer.append(1)
				answer.append(n - (k - 1))
				return ' '.join(list(map(lambda x: str(x), answer)))
		if (n % 2 == 1) & (k % 2 == 0):
			return 'NO'
		if (n % 2 == 1) & (k % 2 == 1):
			for i in range(k - 1):
				answer.append(1)
			answer.append(n - (k - 1))
			return ' '.join(list(map(lambda x: str(x), answer)))

def solve(n, k):
	if k > n:
		return 'NO'
	elif (k % 2 == 0) & (n % 2 == 1):
		return 'NO'
	elif assemble(n, k) == 'NO':
		return 'NO'
	else:
		return '\n'.join(['YES', assemble(n, k)])
t = int(input())
answers = []
for i in range(t):
	(n, k) = to_list(input())
	answers.append(solve(n, k))
print('\n'.join(answers))


for _ in range(int(input())):
	(n, k) = [int(i) for i in input().split()]
	n1 = n - k + 1
	n2 = n - 2 * (k - 1)
	if n2 % 2 == 0 and n2 > 0:
		print('YES')
		print(*[n2] + [2] * (k - 1))
	elif n1 % 2 == 1 and n1 > 0:
		print('YES')
		print(*[n1] + [1] * (k - 1))
	else:
		print('NO')


for j in range(int(input())):
	(n, k) = map(int, input().split())
	if k > n:
		print('no')
		continue
	if n == k:
		print('yes')
		print('1 ' * k, sep='')
		continue
	if k % 2 == n % 2 and n >= k + 2:
		print('yes')
		print('1 ' * (k - 1), n - k + 1, sep='')
	elif n % 2 == 0 and k % 2 != n % 2 and (n >= k * 2):
		print('yes')
		print('2 ' * (k - 1), n - 2 * (k - 1), sep='')
	else:
		print('no')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	even = []
	odd = []
	esum = 0
	osum = 0
	for i in range(k - 1):
		even.append(2)
		odd.append(1)
		esum += 2
		osum += 1
	if n - esum > 0 and (n - esum) % 2 == 0:
		even.append(n - esum)
		print('YES')
		print(' '.join(map(str, even)))
	elif n - osum > 0 and (n - osum) % 2 == 1:
		odd.append(n - osum)
		print('YES')
		print(' '.join(map(str, odd)))
	else:
		print('NO')


def run():
	(n, k) = list(map(int, input().split()))
	if n % 2 == 0:
		if n >= k and k % 2 == 0:
			print('YES')
			print('{}'.format(n - k + 1), end='')
			for i in range(k - 1):
				print(' 1', end='')
			print('')
		elif 2 * k <= n:
			print('YES')
			print('{}'.format(n - 2 * k + 2), end='')
			for i in range(k - 1):
				print(' 2', end='')
			print('')
		else:
			print('NO')
	elif k % 2 == 0:
		print('NO')
	elif k > n:
		print('NO')
	else:
		print('YES')
		print('{}'.format(n - k + 1), end='')
		for i in range(k - 1):
			print(' 1', end='')
		print('')
T = int(input())
for i in range(T):
	run()


def solve_old(n, k):
	if k == 1:
		return [n]
	if n < k:
		return None
	if n == k:
		return [1] * k
	if k % 2 == 0:
		if n % 2 != 0:
			return None
		assert n % 2 == 0
		if n < k * 2:
			return None
		a = [2] * k
		a[0] += n - 2 * k
		assert a[0] % 2 == 0
		return a
	assert k % 2 != 0
	if n % 2 == 0:
		if n < k * 2:
			return None
		a = [2] * k
		a[0] += n - 2 * k
		assert a[0] % 2 == 0
		return a
	assert n % 2 != 0
	if n < k:
		return None
	a = [1] * k
	a[0] += n - k
	assert a[0] % 2 != 0
	return a

def solve(n, k):
	if n < k:
		return None
	a_odd = [1] * k
	a_odd[0] += n - k
	if a_odd[0] % 2 != 0:
		return a_odd
	if n < 2 * k:
		return None
	a_even = [2] * k
	a_even[0] += n - 2 * k
	if a_even[0] % 2 == 0:
		return a_even
	return None

def main():
	T = int(input())
	for _ in range(T):
		(n, k) = map(int, input().split())
		arr = solve(n, k)
		if not arr:
			print('NO')
		else:
			print('YES')
			print(' '.join(map(str, arr)))
main()


def even(n, k, a):
	if n <= k:
		return False
	if n % k == 0 and n // k % 2 == 0:
		for i in range(k):
			a.append(n // k)
		return True
	a.append(2)
	return even(n - 2, k - 1, a)

def odd(n, k, a):
	if n < k:
		return False
	if n % k == 0 and n // k % 2 == 1:
		for i in range(k):
			a.append(n // k)
		return True
	a.append(1)
	return odd(n - 1, k - 1, a)

def summands(n, k):
	if n < k:
		return ('NO', [])
	if n % k == 0:
		return ('YES', [n // k for i in range(k)])
	(a, b) = ([], [])
	if n % 2 == 0 and k % 2 == 1:
		if even(n, k, a):
			return ('YES', a)
		else:
			return ('NO', [])
	if n % 2 == 0 and k % 2 == 0:
		if even(n, k, a):
			return ('YES', a)
		elif odd(n, k, b):
			return ('YES', b)
		else:
			return ('NO', [])
	if n % 2 == 1 and k % 2 == 0:
		return ('NO', [])
	if n % 2 == 1 and k % 2 == 1:
		if odd(n, k, a):
			return ('YES', a)
		else:
			return ('NO', [])
t = int(input())
for i in range(t):
	a = input().split()
	n = int(a[0])
	k = int(a[1])
	(ans, li) = summands(n, k)
	print(ans)
	if ans:
		print(*li)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	(x, y) = (n - (k - 1), n - 2 * (k - 1))
	if x > 0 and x % 2 == 1:
		a = [x] + [1] * (k - 1)
		print('YES')
		print(*a)
	elif y > 0 and y % 2 == 0:
		a = [y] + [2] * (k - 1)
		print('YES')
		print(*a)
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	(n, k) = map(int, input().split())
	if n < k:
		print('no')
	elif n > k:
		if (n - (k - 1)) % 2 != 0:
			l = []
			for i in range(0, k - 1):
				l.append(1)
			if sum(l) + (n - (k - 1)) == n and (n - (k - 1)) % 2 != 0:
				print('yes')
				print(*l, end='')
				print('', abs(n - (k - 1)))
			else:
				print('no')
		else:
			l = []
			for j in range(0, k - 1):
				l.append(2)
			if sum(l) + (n - (k - 1) * 2) == n and n - (k - 1) * 2 > 0 and ((n - (k - 1) * 2) % 2 == 0):
				print('yes')
				print(*l, end='')
				print('', abs(n - (k - 1) * 2))
			else:
				print('no')
	elif n == k:
		print('yes')
		for i in range(0, k):
			print('1', end=' ')
		print('')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	even = True
	odd = True
	l = []
	r = []
	for j in range(k - 1):
		l.append(1)
	for y in range(k - 1):
		r.append(2)
	z = sum(l)
	v = sum(r)
	if (n - z) % 2 != 0 and n - z > 0:
		l.append(n - z)
	elif (n - v) % 2 == 0 and n - v > 0:
		r.append(n - v)
	if len(l) == k:
		print('YES')
		print(*l)
	elif len(r) == k:
		print('YES')
		print(*r)
	else:
		print('NO')


t = int(input())
for i in range(t):
	nk = list(map(int, input().split()))
	n = nk[0]
	k = nk[1]
	output = []
	if k > n:
		print('NO')
		continue
	elif k == n:
		output = [1 for i in range(k)]
	elif n % 2 == 1 and k % 2 == 0:
		print('NO')
		continue
	elif n % 2 == 0:
		if k % 2:
			if k > n // 2:
				print('NO')
				continue
			else:
				output = [2 for i in range(k - 1)]
				output.append(n - (k - 1) * 2)
		else:
			output = [1 for i in range(k - 1)]
			output.append(n - (k - 1))
	else:
		output = [1 for i in range(k - 1)]
		output.append(n - (k - 1))
	print('YES')
	print(*output)


from sys import stdin, stdout
for test in range(int(stdin.readline())):
	arr = [int(x) for x in stdin.readline().split()]
	n = arr[0]
	k = arr[1]
	ans = [n // k] * k
	rem = n % k
	if rem == 0:
		print('YES')
		print(*ans, sep=' ')
	elif k > n or k == 2:
		print('NO')
	else:
		temp = n - k + 1
		answ = [1] * (k - 1)
		if temp % 2 == 1:
			print('YES')
			answ.append(temp)
			print(*answ, sep=' ')
		elif (k - 1) % 2 == 0:
			if n >= 2 * k:
				print('YES')
				answ = [2] * (k - 1)
				answ.append(temp + 1 - k)
				print(*answ, sep=' ')
			else:
				print('NO')
		else:
			print('NO')


import math
t = int(input())
for tt in range(t):
	(n, k) = map(int, input().split())
	even = 2
	flag = False
	temp = n
	xx = k
	ans = []
	while temp > 0 and xx > 1:
		ans.append(even)
		temp -= even
		xx -= 1
		if xx == 1:
			break
	if temp % 2 == 0 and temp != 0:
		ans.append(temp)
		print('YES')
		for i in ans:
			print(i, end=' ')
		print()
		continue
	temp = n
	odd = 1
	xx = k
	ans = []
	while temp > 0 and xx > 1:
		ans.append(odd)
		temp -= odd
		xx -= 1
		if xx == 1:
			break
	if temp % 2 == 1 and temp != 0:
		ans.append(temp)
		print('YES')
		for i in ans:
			print(i, end=' ')
		print()
		continue
	print('NO')


def r(t=int):
	return list(map(t, input().split()))

def ri(t=int):
	return t(input())

def cd(it):
	ret_val = dict()
	for v in it:
		ret_val[v] = ret_val.get(v, 0) + 1
	return ret_val
for h in range(ri()):
	(n, k) = r()
	if n == k:
		print('YES')
		for _ in range(k):
			print(1, end=' ')
		print()
	elif n % 2 == k % 2 and k <= n:
		print('YES')
		for _ in range(k - 1):
			print(1, end=' ')
		print(n - k + 1)
	elif not n % 2 and k * 2 <= n:
		print('YES')
		for _ in range(k - 1):
			print(2, end=' ')
		print(n - (k - 1) * 2)
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	(n, k) = list(map(int, input().split()))
	checker_odd = n - (k - 1)
	checker_even = n - 2 * (k - 1)
	if checker_odd % 2 == 1 and checker_odd > 0:
		print('YES')
		for i in range(1, k):
			print(1)
		print(checker_odd)
	elif checker_even % 2 == 0 and checker_even > 0:
		print('YES')
		for i in range(1, k):
			print(2)
		print(checker_even)
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	if k > n:
		print('NO')
	elif n == k:
		l = [1] * k
		print('YES')
		print(*l)
	else:
		odd = (k - 1) * 1
		even = (k - 1) * 2
		if n - odd > 0 and (n - odd) % 2 == 1:
			l = [1] * (k - 1)
			l.append(n - odd)
			print('YES')
			print(*l)
		elif n - even > 0 and (n - even) % 2 == 0:
			l = [2] * (k - 1)
			l.append(n - even)
			print('YES')
			print(*l)
		else:
			print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	n1 = n
	af = False
	ar = []
	for i in range(k - 1):
		ar.append(2)
		n1 -= 2
	if n1 > 0 and n1 % 2 == 0:
		af = True
		ar.append(n1)
		print('YES')
		print(*ar)
	ar = []
	n1 = n
	if not af:
		for i in range(k - 1):
			ar.append(1)
			n1 -= 1
		if n1 > 0 and n1 % 2 == 1:
			ar.append(n1)
			af = True
			print('YES')
			print(*ar)
	if not af:
		print('NO')


t = int(input())
for i in range(t):
	(n, k) = list(map(int, input().split()))
	temp = 2 * (k - 1)
	new_n = n - temp
	if new_n > 0:
		if new_n % 2 == 0:
			print('YES')
			for i in range(k - 1):
				print(2, end=' ')
			print(new_n)
			continue
	temp = k - 1
	new_n = n - temp
	if new_n > 0:
		if new_n % 2 != 0:
			print('YES')
			for i in range(k - 1):
				print(1, end=' ')
			print(new_n)
			continue
	print('NO')


import sys
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def read():
	c = 0
	if c:
		input = sys.stdin.readline
	else:
		sys.stdin = open('input1.txt', 'r')
		sys.stdout = open('output1.txt', 'w')

def solve():
	for _ in range(ii()):
		(n, k) = mi()
		if n < k:
			print('NO')
		elif n & 1:
			if k % 2 == 0:
				print('NO')
			else:
				print('YES')
				a = [1] * (k - 1)
				n -= k - 1
				a.append(n)
				print(*a)
		elif n == k:
			print('YES')
			s = [1] * k
			print(*s)
		elif k & 1 and n < 2 * k:
			print('NO')
		else:
			print('YES')
			if k & 1:
				a = [2] * (k - 1)
				n -= 2 * (k - 1)
				a.append(n)
				print(*a)
			else:
				a = [1] * (k - 1)
				n -= k - 1
				a.append(n)
				print(*a)
solve()


T = int(input())
for t in range(T):
	(n, k) = list(map(int, input().split()))
	res = 'YES'
	r = (k - 1) * [1]
	reminder = n - k + 1
	if reminder <= 0:
		res = 'NO'
	elif reminder % 2 != 1:
		res = 'NO'
	else:
		r.append(reminder)
	if res == 'NO':
		r = (k - 1) * [2]
		reminder = n - 2 * (k - 1)
		if reminder <= 0:
			res = 'NO'
		elif reminder % 2 != 0:
			res = 'NO'
		else:
			res = 'YES'
			r.append(reminder)
	print(res)
	if res == 'YES':
		print(' '.join(map(str, r)))


def readStr():
	return input()

def readInts():
	return list(map(int, readStr().split(' ')))

def a(n, k, a1):
	ak = n - a1 * (k - 1)
	if ak > 0:
		return [a1 for i in range(k - 1)] + [ak]
	else:
		return None

def main(n, k):
	if n % 2 == 0:
		if k % 2 == 0:
			return a(n, k, 1)
		else:
			return a(n, k, 2)
	elif k % 2 == 0:
		return None
	else:
		return a(n, k, 1)
(t,) = readInts()
for _ in range(t):
	(n, k) = readInts()
	ai = main(n, k)
	if ai:
		print('YES')
		print(' '.join(map(str, ai)))
	else:
		print('NO')


t = int(input())
for i1 in range(t):
	(n, k) = list(map(int, input().split()))
	x = n - (k - 1) * 2
	y = n - (k - 1) * 1
	if x > 0 and x % 2 == 0:
		print('YES')
		print('2 ' * (k - 1) + str(x))
	elif y > 0 and y % 2 == 1:
		print('YES')
		print('1 ' * (k - 1) + str(y))
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	ans = []
	if k > n or (n % 2 == 1 and k % 2 == 0) or (k % 2 == 1 and n % 2 == 0 and (k > n // 2)):
		print('NO')
	else:
		if k % 2 == 1 and n % 2 == 0:
			while k != 1:
				ans.append(2)
				n -= 2
				k -= 1
			ans.append(n)
		else:
			while k != 1:
				ans.append(1)
				n -= 1
				k -= 1
			ans.append(n)
		print('YES')
		print(*ans)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n & 1 and (not k & 1):
		print('NO')
		continue
	ans = []
	if n % 2 == 0:
		if not k & 1:
			if k > n:
				print('NO')
			else:
				print('YES')
				total = 0
				for i in range(k - 1):
					print(1, end=' ')
					total += 1
				print(n - total)
		elif n < 2 * k:
			print('NO')
		else:
			print('YES')
			total = 0
			for i in range(k - 1):
				print(2, end=' ')
				total += 2
			print(n - total)
	elif k > n:
		print('NO')
	else:
		print('YES')
		total = 0
		for i in range(k - 1):
			print(1, end=' ')
			total += 1
		print(n - total)


import math
import sys
t = int(input())
while t:
	t -= 1
	(n, k) = [int(x) for x in input().split()]
	if k > n:
		print('NO')
		continue
	else:
		answer = []
		if 2 * k <= n and (not n & 1):
			while k > 1:
				answer.append(2)
				n -= 2
				k -= 1
			answer.append(n)
		elif k & 1 != n & 1:
			print('NO')
			continue
		else:
			while k > 1:
				answer.append(1)
				n -= 1
				k -= 1
			answer.append(n)
		print('YES')
		print(*answer)


def solve():
	(n, k) = map(int, input().split())
	n1 = n - (k - 1)
	if n1 & 1 and n1 > 0:
		print('YES')
		for i in range(k - 1):
			print('1 ', end='')
		print(n1)
		return
	n2 = n - 2 * (k - 1)
	if n2 & 1 == 0 and n2 > 0:
		print('YES')
		for i in range(k - 1):
			print('2 ', end='')
		print(n2)
		return
	print('NO')
for _ in range(int(input())):
	solve()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if k > n or (n % 2 != 0 and k % 2 == 0):
		print('NO')
	elif n % 2 == 0:
		A = []
		p = k
		k = k - 1
		while k > 0:
			A.append(2)
			k -= 1
		if (n - (p - 1) * 2) % 2 == 0 and n - (p - 1) * 2 > 0:
			print('YES')
			print(*A, end=' ')
			print(n - 2 * (p - 1))
		elif (n - (p - 1)) % 2 != 0 and n - (p - 1) > 0:
			print('YES')
			print('1 ' * (p - 1), end=' ')
			print(n - (p - 1))
		else:
			print('NO')
	elif n % 2 != 0:
		if (n - (k - 1)) % 2 != 0 and n - (k - 1) > 0:
			print('YES')
			print('1 ' * (k - 1), n - (k - 1))


from math import ceil

def solve():
	t = int(input())
	for i in range(t):
		(n, k) = [int(s) for s in input().split()]
		if n % 2 == 0:
			ans = []
			if k % 2 == 0:
				ans = [1] * (k - 1)
				if k - 1 < n:
					ans.append(n - (k - 1))
			ans2 = [2] * (k - 1)
			if (k - 1) * 2 < n:
				ans2.append(n - 2 * (k - 1))
			if len(ans) == k:
				print('YES')
				print(*ans)
			elif len(ans2) == k:
				print('YES')
				print(*ans2)
			else:
				print('NO')
		elif k % 2 != 0:
			ans = [1] * (k - 1)
			if k - 1 < n:
				ans.append(n - (k - 1))
			if len(ans) == k:
				print('YES')
				print(*ans)
			else:
				print('NO')
		else:
			print('NO')
solve()


def main():
	import sys
	input = sys.stdin.buffer.readline

	def GCD(x, y):
		while y:
			(x, y) = (y, x % y)
		return x

	def lcm(a, b):
		return a * b // GCD(a, b)

	def merge(a, start, mid, end, d):
		p = start
		q = mid + 1
		arr = [0] * (end - start + 1)
		k = 0
		coun = 0
		for i in range(start, end + 1):
			if p > mid:
				arr[k] = a[q]
				q += 1
				k += 1
			elif q > end:
				arr[k] = a[p]
				d[a[p]] += coun
				k += 1
				p += 1
			elif a[p] < a[q]:
				arr[k] = a[p]
				d[a[p]] += coun
				k += 1
				p += 1
			else:
				arr[k] = a[q]
				k += 1
				q += 1
				coun += 1
		for i in range(k):
			a[start] = arr[i]
			start += 1

	def mergesort(a, start, end, d):
		if start < end:
			mid = (start + end) // 2
			mergesort(a, start, mid, d)
			mergesort(a, mid + 1, end, d)
			merge(a, start, mid, end, d)

	def inversion(l):
		d = {}
		for i in l:
			d[i] = 0
		mergesort(l, 0, len(l) - 1, d)
		return d

	def binary_search_lower(A, low, high, k):
		if high - low != 1:
			mid = (low + high) // 2
			x = A[mid]
			if x >= k:
				return binary_search_lower(A, low, mid, k)
			else:
				return binary_search_lower(A, mid, high, k)
		if A[low] >= k:
			return low
		else:
			return high

	def binary_expo(x, n):
		if n == 0:
			return 1
		elif n % 2 == 0:
			return binary_expo(x * x, n // 2)
		else:
			return x * binary_expo(x * x, (n - 1) // 2)

	def modu_expo(x, n, m):
		if n == 0:
			return 1
		elif n % 2 == 0:
			return modu_expo(x * x % m, n // 2, m)
		else:
			return x * modu_expo(x * x % m, (n - 1) // 2, m) % m

	def eEuclid(c, m):
		if m == 0:
			global d
			global x
			global y
			d = c
			x = 1
			y = 0
		else:
			eEuclid(m, c % m)
			temp = x
			x = y
			y = temp - c // m * y

	def mod_Inv(c, m):
		eEuclid(c, m)
		return (x % m + m) % m

	def ncr(n, r, p):
		num = den = 1
		for i in range(r):
			num = num * (n - i) % p
			den = den * (i + 1) % p
		return num * pow(den, p - 2, p) % p
	for _ in range(int(input())):
		(n, k) = map(int, input().split())
		if n % k == 0:
			ans = [n // k] * k
		else:
			ans = [n // k] * k
			ans[0] += n % k
		even = []
		e = 0
		for i in ans:
			if i % 2 != 0 and i != 0:
				i = i - 1
				e += 1
			even.append(i)
		if e % 2 == 0:
			even[0] += e
			if 0 not in even:
				print('YES')
				for i in even:
					print(i, end=' ')
				print()
				continue
		odd = []
		o = 0
		for i in ans:
			if i % 2 == 0 and i != 0:
				i = i - 1
				o += 1
			odd.append(i)
		if o % 2 == 0:
			odd[0] += o
			if 0 not in odd:
				print('YES')
				for i in odd:
					print(i, end=' ')
				print()
				continue
		print('NO')
main()


def solve(n, k):
	l = []
	if n < k:
		return 0
	o = n - k + 1
	e = n - 2 * (k - 1)
	if o & 1 == 1:
		l = [1] * (k - 1)
		l.append(o)
		return l
	if e & 1 == 0 and e > 0:
		l = [2] * (k - 1)
		l.append(e)
		return l
	return 0
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	res = solve(n, k)
	if res:
		print('YES')
		print(*res)
	else:
		print('NO')


import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]

def main():
	for _ in range(II()):
		(n, k) = MI()
		if n & 1 ^ k & 1 == 0:
			if n < k:
				print('NO')
				continue
			ans = [1] * (k - 1) + [n - (k - 1)]
		elif n & 1:
			print('NO')
			continue
		else:
			if n < 2 * k:
				print('NO')
				continue
			ans = [2] * (k - 1) + [n - 2 * (k - 1)]
		print('YES')
		print(*ans)
main()


t = int(input())
while t:
	(n, k) = list(map(int, input().split()))
	flag = 0
	s = 0
	a = []
	if n % 2 != 0:
		s += k - 1
		if s > n:
			flag = 1
		else:
			d = n - s
			if d != 0 and d % 2 != 0:
				a = [1] * (k - 1)
				a.append(d)
			else:
				flag = 1
	else:
		s1 = k - 1
		if s1 > n:
			flag = 1
		else:
			d = n - s1
			if d != 0 and d % 2 != 0:
				a = [1] * (k - 1)
				a.append(d)
			else:
				flag = 1
		if flag == 1:
			s2 = 2 * (k - 1)
			if s2 > n:
				flag = 1
			else:
				d = n - s2
				if d != 0 and d % 2 == 0:
					a = [2] * (k - 1)
					a.append(d)
				else:
					flag = 1
	if a == []:
		print('NO')
	else:
		print('YES')
		print(*a)
	t -= 1


def sameParityNumbers(n, k):
	if n % 2 != 0 and k % 2 == 0 or (n % 2 == 0 and k % 2 != 0 and (n < 2 * k)) or k > n:
		return None
	if n % 2 == 0 and k % 2 == 0:
		return [n - k + 1] + [1] * (k - 1)
	elif n % 2 == 0 and k % 2 != 0:
		return [n - (k - 1) * 2] + [2] * (k - 1)
	else:
		return [n - k + 1] + [1] * (k - 1)
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	result = sameParityNumbers(n, k)
	if not result:
		print('NO')
	else:
		print('YES')
		print(*result)


t = int(input())
while t > 0:
	(n, k) = map(int, input().split())
	op = []
	if n >= k:
		if n % 2 == 0:
			if n // 2 >= k:
				for i in range(k - 1):
					op.append(2)
					n -= 2
				op.append(n)
				print('YES')
				print(*op)
			elif k % 2 == 0:
				for i in range(k - 1):
					op.append(1)
					n -= 1
				op.append(n)
				print('YES')
				print(*op)
			else:
				print('NO')
		elif k % 2 != 0:
			for i in range(k - 1):
				op.append(1)
				n -= 1
			op.append(n)
			print('YES')
			print(*op)
		else:
			print('NO')
	else:
		print('NO')
	t -= 1


def same_sum(n, k):
	if k > n:
		print('NO')
	elif n % 2 == 1 and k % 2 == 0:
		print('NO')
	elif n % 2 == 0 and k % 2 == 1 and (2 * k > n):
		print('NO')
	else:
		print('YES')
		if n % 2 == 1 or (n % 2 == 0 and k % 2 == 0):
			for i in range(k - 1):
				print(1, end=' ')
			print(n - k + 1)
		else:
			for i in range(k - 1):
				print(2, end=' ')
			print(n - 2 * (k - 1))

def main():
	t = int(input())
	for i in range(t):
		(n, k) = [int(x) for x in input().split()]
		same_sum(n, k)
main()


for testcase in range(int(input())):
	(n, k) = map(int, input().split())
	last = n - (k - 1)
	ans = []
	if last > 0 and last & 1 == 1:
		ans = [1] * (k - 1) + [last]
	last = n - 2 * (k - 1)
	if last > 0 and last & 1 == 0:
		ans = [2] * (k - 1) + [last]
	if ans:
		print('YES')
		print(*ans)
	else:
		print('NO')


def main():
	x = int(input())
	array = [str(input()).split() for _ in range(x)]
	for (n, k) in array:
		if (int(n) - int(k) + 1) % 2 == 1 and int(n) - int(k) + 1 > 0:
			var_arr = ['1' for _ in range(int(n) - (int(n) - int(k) + 1))]
			print(f"YES\n{' '.join(var_arr)} {int(n) - int(k) + 1}")
		elif n == '2' and k == '1' or (n == '4' and k == '1'):
			print(f'YES\n{n}')
		elif (int(n) - int(k) * 2) % 2 == 0 and int(n) - int(k) * 2 > 0 or int(n) - int(k) * 2 == 0:
			var_arr = ['2' for _ in range(int(n) - (int(n) - int(k) + 1))]
			print(f"YES\n{' '.join(var_arr)} {int(n) - (int(n) - (int(n) - int(k) + 1)) * 2}")
		else:
			print('NO')
main()


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split(' '))
	if k == 1:
		print('YES')
		print(n)
		continue
	if (n - k) % 2 == 0 and n - k + 1 > 0:
		print('YES')
		print(' '.join(['1'] * (k - 1)), n - k + 1)
		continue
	if n % 2 == 0 and n > 2 * (k - 1):
		print('YES')
		print(' '.join(['2'] * (k - 1)), n - 2 * (k - 1))
		continue
	print('NO')


from sys import stdin, stdout
cin = stdin.readline
cout = stdout.write
mp = lambda : list(map(int, cin().split()))

def chars():
	s = cin()
	return list(s[:len(s) - 1])

def pl(a):
	for val in a:
		cout(str(val) + ' ')
	cout('\n')
(t,) = mp()
for _ in range(t):
	(n, k) = mp()
	a = []
	if not n % 2:
		if k * 2 > n:
			if not k % 2 and k <= n:
				cout('yes\n')
				pl([1] * (k - 1) + [n - k + 1])
			else:
				cout('no\n')
		else:
			cout('yes\n')
			pl([2] * (k - 1) + [n - 2 * (k - 1)])
	elif not k % 2:
		cout('no\n')
	elif k > n:
		cout('no\n')
	else:
		cout('yes\n')
		pl([1] * (k - 1) + [n - k + 1])


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
		continue
	a1 = k % 2
	a2 = n % 2
	if a1 == a2:
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(n - k + 1)
		continue
	elif a1 == 0 and a2 == 1:
		print('NO')
	else:
		s = (k - 1) * 2
		r = n - s
		if r < 2:
			print('NO')
		else:
			print('YES')
			for i in range(k - 1):
				print(2, end=' ')
			print(r)


def f(l):
	(n, k) = l
	if n < k:
		return [['NO']]
	if (n - k) % 2 == 0:
		return [['YES'], [1] * (k - 1) + [1 + n - k]]
	if n < k << 1:
		return [['NO']]
	if (n - k - k) % 2 == 0:
		return [['YES'], [2] * (k - 1) + [2 + n - k - k]]
	return [['NO']]
q = int(input())
for _ in range(q):
	l = list(map(int, input().split()))
	[print(*r) for r in f(l)]


a = int(input())
for _ in range(a):
	(b, c) = map(int, input().split())
	if c > b:
		print('NO')
	elif b % 2 != 0 and c % 2 == 0:
		print('NO')
	elif c > b // 2:
		if (b - c - 1) % 2 != 0:
			print('YES')
			print('1 ' * (c - 1) + str(b - (c - 1)))
		else:
			print('NO')
	elif b % 2 != 0:
		if (b - c - 1) % 2 != 0:
			print('YES')
			print('1 ' * (c - 1) + str(b - (c - 1)))
		else:
			print('NO')
	elif (b - 2 * (c - 1)) % 2 == 0:
		print('YES')
		print('2 ' * (c - 1) + str(b - (c - 1) * 2))
	else:
		print('NO')


testy = int(input(''))
results = []

def wynik(n, k):
	result = []
	m = n
	l = k
	if n % 2 == 1 and k % 2 == 0:
		result.append('NO')
		return result
	elif n % 2 == 1 and k % 2 == 1 and (n >= k):
		result.append('YES')
		while l > 1:
			result.append(1)
			m -= 1
			l -= 1
		result.append(n - k + 1)
		return result
	elif n % 2 == 0 and n >= k * 2:
		result.append('YES')
		while l > 1:
			result.append(2)
			m -= 2
			l -= 1
		result.append(n - k * 2 + 2)
		return result
	elif n % 2 == 0 and k % 2 == 0 and (n >= k):
		result.append('YES')
		while l > 1:
			result.append(1)
			m -= 1
			l -= 1
		result.append(n - k + 1)
		return result
	else:
		result.append('NO')
		return result
for i in range(0, testy):
	wejscie = input('')
	n = int(wejscie.split()[0])
	k = int(wejscie.split()[1])
	results.append(wynik(n, k))
for result in results:
	for czesc in result:
		if type(czesc) == str:
			print(czesc)
		else:
			print(czesc, end='')
			print(' ', end='')
	if result[0] == 'YES':
		print('')


t = int(input())
while t > 0:
	(n, k) = input().split(' ')
	(n, k) = (int(n), int(k))
	arr = []
	v1 = n - (k - 1)
	v2 = n - 2 * (k - 1)
	if v1 % 2 == 1 and v1 > 0:
		arr = [1] * (k - 1)
		arr.append(v1)
	elif v2 % 2 == 0 and v2 > 0:
		arr = [2] * (k - 1)
		arr.append(v2)
	if len(arr) > 0:
		print('YES')
		for i in arr:
			print(i, end=' ')
		print()
	else:
		print('NO')
	t -= 1


def main():
	for _ in range(int(input())):
		(n, k) = map(int, input().split())
		nOdd = n - k + 1
		if nOdd > 0 and nOdd % 2 == 1:
			print('YES')
			print('1 ' * (k - 1), nOdd, sep='')
			continue
		nEven = n - 2 * (k - 1)
		if nEven > 0 and nEven % 2 == 0:
			print('YES')
			print('2 ' * (k - 1), nEven, sep='')
			continue
		print('NO')
main()


tc = int(input())
for zzz in range(tc):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
		continue
	if n % 2 == 0:
		l = n // 2
		if k <= l:
			print('YES')
			s = 0
			for i in range(1, k):
				s += 2
				print('2', end=' ')
			print(n - s)
		elif k % 2 == 0:
			print('YES')
			s = 0
			for i in range(1, k):
				s += 1
				print('1', end=' ')
			print(n - s)
		else:
			print('NO')
	elif k % 2 == 1:
		print('YES')
		s = 0
		for i in range(1, k):
			s += 1
			print('1', end=' ')
		print(n - s)
	else:
		print('NO')


from sys import stdout, stdin
(_input, _print) = (stdin.buffer.readline, stdout.write)
(_str, _range, _int) = (str, range, int)

def solution():
	for _ in _range(_int(_input())):
		(n, k) = [_int(i) for i in _input().split()]
		if n % 2 != 0:
			if k % 2 != 0 and n >= k:
				print('YES')
				print('1 ' * (k - 1) + _str(n - k + 1))
			else:
				print('NO')
		elif n >= k * 2:
			print('YES')
			print('2 ' * (k - 1) + _str(n - (k - 1) * 2))
		elif k % 2 == 0 and n >= k:
			print('YES')
			print('1 ' * (k - 1) + _str(n - k + 1))
		else:
			print('NO')
solution()


MOD = 1000000007

def solve(n, k):
	ans = []
	k1 = k
	if n >= k:
		while k1 != 1:
			ans.append(1)
			k1 -= 1
		val2 = n - sum(ans)
		if val2 > 0 and val2 % 2 == 1:
			ans.append(val2)
			print('YES')
			print(*ans, sep=' ')
		else:
			ans.clear()
			k1 = k
			while k1 != 1:
				ans.append(2)
				k1 -= 1
			val2 = n - sum(ans)
			if val2 > 0 and val2 % 2 == 0:
				ans.append(val2)
				print('YES')
				print(*ans, sep=' ')
			else:
				print('NO')
	else:
		print('NO')
for i in range(int(input())):
	(n, k) = map(int, input().split())
	solve(n, k)


t = int(input())
for we in range(t):
	(n, k) = map(int, input().split())
	s = 0
	l = []
	odd = n - (k - 1)
	even = n - 2 * (k - 1)
	m = 0
	if odd > 0 and odd % 2 != 0:
		m = 1
	if even > 0 and even % 2 == 0:
		m = 2
	if m == 0:
		print('NO')
	elif m == 1:
		print('YES')
		for j in range(k - 1):
			print('1', end=' ')
		print(odd)
	else:
		print('YES')
		for j in range(k - 1):
			print('2', end=' ')
		print(even)


def even1(n, k):
	li1 = []
	if n // 2 // k > 0:
		value = n // 2 // k
		for i in range(1, k):
			li1.append(2 * value)
		value2 = sum(li1)
		if (n - value2) % 2 == 0:
			li1.append(n - value2)
	return li1

def odd(n, k):
	li1 = []
	if n // k > 0:
		value = n // k
		if value % 2 == 0:
			value = value - 1
		for i in range(1, k):
			li1.append(value)
		value2 = sum(li1)
		if (n - value2) % 2 != 0:
			li1.append(n - value2)
	return li1
testcase = int(input())
for i in range(testcase):
	(n, k) = map(int, input().split())
	li1 = even1(n, k)
	bool2 = True
	for i in range(len(li1)):
		if li1[i] % 2 != 0:
			bool2 = False
	if bool2 == True and sum(li1) == n:
		print('YES')
		print(*li1)
	else:
		li1 = odd(n, k)
		bool2 = True
		for i in range(len(li1)):
			if li1[i] % 2 == 0:
				bool2 = False
		if bool2 == True and sum(li1) == n:
			print('YES')
			print(*li1)
		else:
			print('NO')


T = int(input())
for _ in range(T):
	(N, K) = map(int, input().split())
	if N % 2 == 1 and K % 2 == 0 or N < K:
		print('No')
		continue
	div = N // K
	mod = N % K
	if mod % 2 == 0:
		print('Yes')
		ans = [str(div)] * (K - 1) + [str(div + mod)]
		print(' '.join(ans))
		continue
	elif mod % 2 == 1:
		div = div - 1
		ans = [str(div)] * (K - 1) + [str(N - div * (K - 1))]
		if '0' in ans:
			print('No')
			continue
		else:
			print('Yes')
			print(' '.join(ans))
			continue


test = int(input())
for _ in range(test):
	(n, k) = map(int, input().split())
	(ans1, ans2) = ([1] * (k - 1) + [n - k + 1], [2] * (k - 1) + [n - 2 * (k - 1)])
	if ans1[-1] > 0 and ans1[-1] & 1:
		print('YES')
		print(*ans1)
	elif ans2[-1] > 0 and (not ans2[-1] & 1):
		print('YES')
		print(*ans2)
	else:
		print('NO')


def main():
	n = int(input())
	for i in range(n):
		(n, k) = map(int, input().split())
		if n % 2 == 1:
			if k % 2 == 0:
				print('NO')
			elif n - k + 1 > 0:
				print('YES')
				for j in range(k - 1):
					print(1, end=' ')
				print(n - k + 1)
			else:
				print('NO')
		elif k % 2 == 0 and n - k + 1 > 0:
			print('YES')
			for j in range(k - 1):
				print(1, end=' ')
			print(n - k + 1)
		elif k % 2 == 1 and n - 2 * (k - 1) > 0:
			print('YES')
			for j in range(k - 1):
				print(2, end=' ')
			print(n - 2 * (k - 1))
		else:
			print('NO')
main()


t = int(input())
for case in range(t):
	(n, k) = map(int, input().split())
	if n % 2 == k % 2:
		if n - k >= 0:
			print('YES')
			ans = [1] * (k - 1) + [n - (k - 1)]
			print(*ans)
		else:
			print('NO')
	elif n - 2 * k >= 0 and n % 2 == 0:
		print('YES')
		ans = [2] * (k - 1) + [n - 2 * (k - 1)]
		print(*ans)
	else:
		print('NO')


t = int(input())
while t:
	(n, k) = input().split()
	n = int(n)
	k = int(k)
	n1 = n - (k - 1)
	if n1 > 0 and n1 % 2 == 1:
		print('YES')
		for i in range(k - 1):
			print('1', end=' ')
		print(n1)
		t -= 1
		continue
	n2 = n - 2 * (k - 1)
	if n2 > 0 and n2 % 2 == 0:
		print('YES')
		for i in range(k - 1):
			print('2', end=' ')
		print(n2)
		t -= 1
		continue
	print('NO')
	t -= 1


def solve(n, k):
	x = n - (k - 1)
	if x > 0 and x % 2 == 1:
		print('YES')
		for i in range(0, k - 1, 1):
			print('1', end=' ')
		print(x)
		return
	x = n - (k - 1) * 2
	if x > 0 and x % 2 == 0:
		print('YES')
		for i in range(0, k - 1, 1):
			print('2', end=' ')
		print(x)
		return
	print('NO')
	return
testCases = int(input())
while testCases:
	(N, K) = map(int, input().split())
	solve(N, K)
	testCases -= 1


import sys
import math
import collections
import operator as op
from collections import deque
from math import gcd, inf, sqrt, pi, cos, sin
from bisect import bisect_right, bisect_left
from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)

def factorial(n):
	if n == 0:
		return 1
	return n * factorial(n - 1)

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return len(set(factors))

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def factors(n):
	return list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def mod0cnt(n):
	return n // 3

def mod1cnt(n):
	return n // 3 + (n % 3 != 0)

def mod2cnt(n):
	return n // 3 + (n % 3 == 2) + 1
MOD = 1000000007
T = 1
T = int(stdin.readline())
for _ in range(T):
	(n, k) = list(map(int, stdin.readline().split()))
	if k > n:
		print('NO')
		continue
	ans = []
	if n % 2 == 1:
		if k % 2 == 0:
			print('NO')
			continue
		elif k - 1 >= n:
			print('NO')
			continue
		else:
			ans = [1] * (k - 1)
			ans = ans + [n - k + 1]
	elif k % 2 == 0:
		if k - 1 >= n:
			print('NO')
			continue
		else:
			ans = [1] * (k - 1)
			ans = ans + [n - k + 1]
	elif 2 * (k - 1) >= n:
		print('NO')
		continue
	else:
		ans = [2] * (k - 1)
		ans = ans + [n - 2 * (k - 1)]
	print('YES')
	print(*ans)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	am = True
	l = [1 for _ in range(k - 1)]
	l2 = [2 for _ in range(k - 1)]
	if n - k + 1 > 0 and (n - k + 1) % 2 == 1:
		l.append(n - k + 1)
		am = False
	if n - 2 * k + 2 > 0 and (n - 2 * k + 2) % 2 == 0:
		l2.append(n - 2 * k + 2)
		am = False
	if am == False:
		print('YES')
		if len(l) == k:
			print(*l)
		else:
			print(*l2)
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import math

def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def binary_search(lb, ub, val, cnt):
	mid = (lb + ub) // 2
	if val < mid:
		ub = mid - 1
		binary_search(lb, ub, val, cnt - 1)
	elif val > mid:
		lb = mid + 1
		binary_search(lb, ub, val, cnt - 1)
	else:
		print(cnt)

def abs(x):
	return x if x >= 0 else -x
for t in range(int(input())):
	(n, k) = list(map(int, input().split()))
	if n < k:
		print('NO')
	elif n % k == 0:
		print('YES')
		for i in range(k):
			print(n // k, end=' ')
		print('')
	elif n % k % 2 == 0:
		print('YES')
		print(n // k + n % k, end=' ')
		for i in range(k - 1):
			print(n // k, end=' ')
		print('')
	elif (k - 1) % 2 == 0 and n // k != 1:
		print('YES')
		print(n // k + n % k, end=' ')
		for i in range(k - 1):
			print(n // k + (-1) ** i, end=' ')
		print('')
	else:
		print('NO')


from sys import stdin
input = stdin.readline
for ti in range(int(input().strip())):
	(n, k) = [int(x) for x in input().strip().split()]
	ans = []
	if n < k:
		print('NO')
		continue
	if n % 2:
		if k % 2:
			for ki in range(k - 1):
				ans.append(1)
			n -= k - 1
			ans.append(n)
			print('YES')
			print(*ans)
			continue
		else:
			print('NO')
			continue
	elif k % 2:
		for ki in range(k - 1):
			ans.append(2)
		n -= 2 * (k - 1)
		if n <= 0:
			print('NO')
			continue
		else:
			ans.append(n)
			print('YES')
			print(*ans)
			continue
	else:
		for ki in range(k - 1):
			ans.append(1)
		n -= k - 1
		ans.append(n)
		print('YES')
		print(*ans)
		continue


def isEven(k):
	if k % 2 == 0:
		return True
	return False
n = int(input())
for _ in range(n):
	(n, k) = map(int, input().split())
	mod = n % k
	res = int(n / k)
	if res == 0:
		print('no')
	elif isEven(k):
		if isEven(mod):
			print('yes')
			for _ in range(k - 1):
				print(res, end=' ')
			print(res + mod)
		else:
			print('no')
	elif res == 1 and (not isEven(mod)):
		print('no')
	else:
		print('yes')
		if isEven(mod):
			for _ in range(k - 1):
				print(res, end=' ')
			print(res + mod)
		else:
			halfe = int((k - 1) / 2)
			for _ in range(halfe):
				print(res - 1, end=' ')
				print(res + 1, end=' ')
			print(res + mod)


import getopt
import sys
import math
onlyCase = -1
verbose = False
try:
	(opts, args) = getopt.getopt(sys.argv[1:], 'vc:', ['case='])
except getopt.GetoptError as err:
	print(str(err))
	sys.exit(2)
for (o, a) in opts:
	if o in ('-c', '--case'):
		onlyCase = int(a)
	elif o == '-v':
		verbose = True
	else:
		sys.exit()
ncases = int(input())
for c in range(1, ncases + 1):
	(N, k) = [int(x) for x in input().split()]
	if onlyCase != -1 and onlyCase != c:
		continue
	s = []
	possible = False
	if (N + k) % 2 == 0:
		while k > 1:
			k -= 1
			N -= 1
			s.append(1)
		s.append(N)
		if N > 0:
			possible = True
	elif N % 2 == 0:
		while k > 1:
			k -= 1
			N -= 2
			s.append(2)
		s.append(N)
		if N > 0:
			possible = True
	if not possible:
		print('NO')
	else:
		print('YES')
		print(' '.join(map(str, s)))


from sys import stdin

def main():
	readline = stdin.readline
	t = int(readline())
	for i in range(t):
		(n, k) = map(int, readline().split())
		if n < k:
			print('NO')
		elif n % 2 == 1:
			if k % 2 == 0:
				print('NO')
			else:
				li = [1] * (k - 1)
				li.append(n - (k - 1))
				print('YES')
				print(*li)
		elif k % 2 == 0:
			li = [1] * (k - 1)
			li.append(n - (k - 1))
			print('YES')
			print(*li)
		elif n - 2 * (k - 1) > 0:
			li = [2] * (k - 1)
			li.append(n - 2 * (k - 1))
			print('YES')
			print(*li)
		else:
			print('NO')
main()


t = int(input())
r = []
for i in range(t):
	(n, k) = input().split()
	m = [n, k]
	r.append(m)
for i in r:
	a = int(i[0])
	b = int(i[1])
	if a < b:
		print('NO')
	elif a % 2 == 1:
		if b % 2 == 0:
			print('NO')
		else:
			rr = a - b + 1
			x = [rr]
			c = 0
			while c < b - 1:
				x.append(1)
				c = c + 1
			print('YES')
			print(' '.join(map(str, x)))
	elif b % 2 == 0:
		rr = a - b + 1
		x = [rr]
		c = 0
		while c < b - 1:
			x.append(1)
			c = c + 1
		print('YES')
		print(' '.join(map(str, x)))
	elif 2 * b > a:
		print('NO')
	else:
		rr = a - 2 * b + 2
		x = [rr]
		c = 0
		while c < b - 1:
			x.append(2)
			c = c + 1
		print('YES')
		print(' '.join(map(str, x)))


t = int(input())
while t:
	t -= 1
	(n, k) = map(int, input().split())
	if n < k:
		print('NO')
	else:
		if n == k:
			ans = [1] * k
		elif n % 2 and k % 2 == 0:
			print('NO')
			continue
		elif n % 2 and k % 2:
			ans = [1] * (k - 1) + [n - k + 1]
		elif n % 2 == 0:
			if k % 2:
				if 2 * k > n:
					print('NO')
					continue
				ans = [2] * (k - 1) + [n - (k - 1) * 2]
			else:
				ans = [1] * (k - 1) + [n - (k - 1)]
		if len(ans) == k:
			print('YES')
			print(*ans)
		else:
			print('NO')


N = int(input())
for _ in range(N):
	(n, k) = map(int, input().split())
	ans = []
	o = n
	for i in range(k - 1):
		ans.append(str(2 * 0 + 1))
		o -= 2 * 0 + 1
	if o % 2 == 1 and o > 0:
		ans.append(str(o))
		print('YES')
		print(' '.join(ans))
		continue
	ans = []
	o = n
	for i in range(k - 1):
		ans.append(str(2 * 0 + 2))
		o -= 2 * 0 + 2
	if o % 2 == 0 and o > 0:
		ans.append(str(o))
		print('YES')
		print(' '.join(ans))
		continue
	print('NO')


def solve():
	(n, k) = map(int, input().split())
	ans = []
	if k > n:
		return 'NO'
	else:
		for i in range(k - 1):
			ans.append(2)
		if not (n - sum(ans) <= 0 or (n - sum(ans)) % 2 != 0):
			ans.append(n - sum(ans))
			return ('YES', ans)
		ans = []
		for i in range(k - 1):
			ans.append(1)
		if not (n - sum(ans) <= 0 or (n - sum(ans)) % 2 == 0):
			ans.append(n - sum(ans))
			return ('YES', ans)
		return 'NO'
t = int(input())
for i in range(t):
	ans = solve()
	if ans == 'NO':
		print(ans)
	else:
		print(ans[0])
		print(' '.join(list(map(str, ans[1]))))


b = 'abcdefghijklmnopqrstuvwxyz'
arr = []
d = []
count = 0
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
	else:
		p1 = n - k + 1
		p2 = n - 2 * (k - 1)
		if p1 % 2 == 1 and p1 > 0:
			print('YES')
			print('1 ' * (k - 1) + str(p1))
		elif p2 > 0 and p2 % 2 == 0:
			print('YES')
			print('2 ' * (k - 1) + str(p2))
		else:
			print('NO')


import sys, math, cmath, time
start_time = time.time()
tt = 0

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	return input().strip()

def invr():
	return map(int, input().split())

def solve():
	(n, k) = invr()
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
	elif n % 2 == 0 and k % 2 == 0:
		if n < k:
			print('NO')
		else:
			qw = [1] * (k - 1) + [n - (k - 1)]
			print('YES')
			print(*qw)
	elif n % 2 == 0 and k % 2 == 1:
		if 2 * k > n:
			print('NO')
		else:
			qw = [2] * (k - 1) + [n - 2 * (k - 1)]
			print('YES')
			print(*qw)
	elif n < k:
		print('NO')
	else:
		print('YES')
		qw = [1] * (k - 1) + [n - (k - 1)]
		print(*qw)

def main():
	if not ONLINE_JUDGE:
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	t = 1
	t = inp()
	for tt in range(t):
		solve()
	if not ONLINE_JUDGE:
		print('Time Elapsed :', time.time() - start_time, 'seconds')
	sys.stdout.close()

def counter(a):
	q = [0] * max(a)
	for i in range(len(a)):
		q[a[i] - 1] = q[a[i] - 1] + 1
	return q

def string_counter(a):
	q = [0] * 26
	for i in range(len(a)):
		q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
	return q
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
	input = sys.stdin.readline
main()


def main():
	T = int(input())
	for _ in range(T):
		(N, K) = map(int, input().split())
		if K > N:
			print('NO')
			continue
		if N % 2 == 0:
			if K % 2 == 0:
				print('YES')
				print('1 ' * (K - 1) + str(N - K + 1))
			elif K > N // 2:
				print('NO')
			else:
				print('YES')
				print('2 ' * (K - 1) + str(N - 2 * (K - 1)))
		elif K % 2 == 0:
			print('NO')
		else:
			print('YES')
			print('1 ' * (K - 1) + str(N - K + 1))
main()


for case in range(int(input())):
	(n, k) = list(map(int, input().split()))
	if n <= 0 or k <= 0:
		print('NO')
	if k == 1:
		print('YES')
		print(n)
		continue
	a = int(n / (k - 1))
	b = n - a * (k - 1)
	if b == 0:
		a = a - 1
		b = b + (k - 1)
	count = 0
	while a > 0 and b < n and (count < 10):
		if a % 2 == b % 2:
			break
		a = a - 1
		b = b + (k - 1)
		count = count + 1
	if a * (k - 1) + b == n and a > 0 and (a % 2 == b % 2):
		print('YES')
		print((str(a) + ' ') * (k - 1) + str(b))
	else:
		print('NO')


import sys
input = sys.stdin.readline
from collections import *
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	ans = []
	if k % 2 == 0:
		if n % 2 == 1:
			print('NO')
			continue
		for _ in range(k - 1):
			ans.append(1)
		ans.append(n - (k - 1))
	elif n % 2 == 0:
		for _ in range(k - 1):
			ans.append(2)
		ans.append(n - 2 * (k - 1))
	else:
		for _ in range(k - 1):
			ans.append(1)
		ans.append(n - (k - 1))
	if min(ans) <= 0:
		print('NO')
	else:
		print('YES')
		print(*ans)


class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from bisect import bisect_right, bisect_left
from fractions import Fraction

def pre(s):
	n = len(s)
	pi = [0] * n
	for i in range(1, n):
		j = pi[i - 1]
		while j and s[i] != s[j]:
			j = pi[j - 1]
		if s[i] == s[j]:
			j += 1
		pi[i] = j
	return pi

def prod(a):
	ans = 1
	for each in a:
		ans = ans * each
	return ans

def pari(a):
	for i in range(0, 2, n):
		print(i)
	for i in range(1, 2, n):
		print(i)
from math import gcd

def lcm(a, b):
	return a * b // gcd(a, b)

def f(n, a=1):
	if a == 1:
		a = []
	s = len(str(n))
	p = 10 ** (s - 1)
	ans = 1
	a += [n // p * p]
	n -= a[0]
	if n:
		ans += 1
		a += f(n)
		return a
	else:
		return a
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n % 2 == 0:
		if k % 2 == 0:
			a = []
			for i in range(k - 1):
				a += [1]
				n -= 1
			if n < 1:
				print('NO')
			else:
				print('YES')
				a += [n]
				print(' '.join((str(k) for k in a)))
		else:
			a = []
			for i in range(k - 1):
				a += [2]
				n -= 2
			if n < 2:
				print('NO')
			else:
				print('YES')
				a += [n]
				print(' '.join((str(k) for k in a)))
	else:
		if k % 2 == 0:
			print('NO')
			continue
		a = []
		for i in range(k - 1):
			a += [1]
			n -= 1
		if n < 1:
			print('NO')
		else:
			print('YES')
			a += [n]
			print(' '.join((str(k) for k in a)))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
	else:
		tmp = n
		tmp -= k - 1
		f = 0
		l = []
		if tmp & 1:
			l = [1] * (k - 1)
			l.append(n - (k - 1))
			f = 1
		if f == 0:
			tmp = n
			tmp -= 2 * (k - 1)
			if tmp > 0 and tmp % 2 == 0:
				l = [2] * (k - 1)
				l.append(n - 2 * (k - 1))
				f = 1
		if f:
			print('YES')
			print(*l)
		else:
			print('NO')


def answer(n, k):
	if n < k:
		print('NO')
		return
	if n % 2 != 0 and k % 2 == 0:
		print('NO')
		return
	if n % k == 0:
		print('YES')
		print(*[n // k] * k)
		return
	if n % 2 == 0:
		if k % 2 == 0:
			p = [2] * (k - 1)
			y = [1] * (k - 1)
			if n - 2 * (k - 1) > 0:
				p.append(n - 2 * (k - 1))
				print('YES')
				print(*p)
				return
			elif (n - k + 1) % 2 != 0 and n - k + 1 > 0:
				y.append(n - k + 1)
				print('YES')
				print(*y)
				return
			else:
				print('NO')
				return
		if k % 2 != 0:
			p = [2] * (k - 1)
			if n - 2 * (k - 1) > 0:
				p.append(n - 2 * (k - 1))
				print('YES')
				print(*p)
				return
			else:
				print('NO')
				return
	if n % 2 != 0:
		p = [1] * (k - 1)
		if (n - k + 1) % 2 != 0 and n - k + 1 > 0:
			p.append(n - k + 1)
			print('YES')
			print(*p)
			return
		else:
			print('NO')
			return
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	answer(n, k)


t = int(input())
for s in range(t):
	(n, k) = list(map(int, input().split(' ')))
	y = n // 2
	if n < k:
		print('NO')
	else:
		if n % 2 != 0 and k % 2 == 0:
			print('NO')
		if n % 2 == 0 and k % 2 == 0 or (n % 2 != 0 and k % 2 != 0):
			print('YES')
			c = 0
			for i in range(1, k, 1):
				c += 1
				print(1, end=' ')
			x = n - c
			print(x)
		if n % 2 == 0 and k % 2 != 0:
			if k * 2 <= n:
				print('YES')
				c = 0
				for i in range(1, k, 1):
					c += 2
					print(2, end=' ')
				x = n - c
				print(x)
			else:
				print('NO')


t = int(input())
for tt in range(t):
	(n, k) = map(int, input().split())
	if n % 2 == 0:
		if k % 2 == 0:
			sol = [1] * (k - 1)
		else:
			sol = [2] * (k - 1)
	else:
		sol = [1] * (k - 1)
	sol.append(n - sum(sol))
	if sol[-1] < 1 or sol[0] % 2 != sol[-1] % 2:
		print('NO')
	else:
		print('YES')
		print(' '.join(map(str, sol)))


def sameParitySummands(num: int, num_of_summands: int) -> None:
	if num < num_of_summands:
		print('NO')
		return
	summands = []
	base = int(num / num_of_summands)
	for i in range(num_of_summands):
		summands.append(base)
	summands[0] += num % num_of_summands
	odd_count = 0
	even_count = 0
	for number in summands:
		if number % 2:
			odd_count += 1
		else:
			even_count += 1
	if odd_count == 0 or even_count == 0:
		print('YES')
		for number in summands:
			print(number, end=' ')
		print()
		return
	elif even_count % 2 == 0:
		for i in range(len(summands)):
			if summands[i] % 2 == 0:
				summands[i] -= 1
				continue_loop = True
				j = i + 1
				while continue_loop and j < len(summands):
					if summands[j] % 2 == 0:
						summands[j] += 1
						continue_loop = False
					j += 1
		for number in summands:
			if number % 2 == 0:
				print('NO')
				return
		print('YES')
		for num in summands:
			print(num, end=' ')
		print()
		return
	elif odd_count % 2 == 0:
		for i in range(len(summands)):
			if summands[i] % 2 and summands[i] - 1 != 0:
				summands[i] -= 1
				continue_loop = True
				j = i + 1
				while continue_loop and j < len(summands):
					if summands[j] % 2:
						summands[j] += 1
						continue_loop = False
					j += 1
		for number in summands:
			if number % 2:
				print('NO')
				return
		print('YES')
		for num in summands:
			print(num, end=' ')
		print()
		return
	else:
		print('NO')
		return
test_cases = int(input())
for i in range(test_cases):
	inputs = input().split()
	sameParitySummands(int(inputs[0]), int(inputs[1]))


def g(n, k):
	L = []
	if k == 1:
		L.append(n)
		return L
	elif k == 2:
		L.append(n // k)
		L.append(n // k)
		return L
	if n % 2 == 0 and k % 2 != 0:
		for i in range(k - 1):
			L.append(2)
		L.append(n - 2 * (k - 1))
	else:
		for i in range(k - 1):
			L.append(1)
		L.append(n - (k - 1))
	return L
T = int(input())
while T > 0:
	(n, k) = map(int, input().split())
	if n % 2 == 1 and k % 2 != 1:
		print('NO')
	else:
		A = g(n, k)
		d = 0
		for j in range(len(A)):
			if A[j] <= 0:
				print('NO')
				d = 1
				break
		if d == 0:
			print('YES')
			for i in range(len(A)):
				print(A[i], end=' ')
	T -= 1


tc = int(input())
for _ in range(tc):
	(n, k) = list(map(int, input().split()))
	if (n % 2 == 0 and k % 2 == 0 or (n % 2 == 1 and k % 2 == 1)) and k <= n:
		print('YES')
		print((k - 1) * '1 ' + str(n - (k - 1)))
	elif n % 2 == 0 and n // 2 >= k and (k % 2 == 1):
		print('YES')
		print((k - 1) * '2 ' + str(n - (k - 1) * 2))
	else:
		print('NO')


T = int(input())
for t in range(T):
	(N, K) = map(int, input().split())
	if K % 2 == N % 2:
		ans = [1] * (K - 1) + [N - K + 1]
	elif N % 2 == 1:
		print('NO')
		continue
	elif N % 2 == 0:
		ans = [2] * (K - 1) + [N - (K - 1) * 2]
	if min(ans) <= 0:
		print('NO')
		continue
	print('YES')
	print(' '.join(map(str, ans)))


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
for _ in range(int(inp())):
	(n, k) = mp()
	if k <= n and n % 2 == k % 2:
		print('YES')
		print(*[1 for i in range(k - 1)], end=' ')
		print(n - k + 1)
	elif k <= n // 2 and n % 2 == 0:
		print('YES')
		print(*[2 for i in range(k - 1)], end=' ')
		print(n - 2 * k + 2)
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	out = []
	if k > n or (n % 2 == 0 and k % 2 != 0 and (n / k < 2)) or (n % 2 != 0 and k % 2 == 0):
		print('NO')
	else:
		print('YES')
		if n % 2 == 0 and k % 2 != 0:
			for i in range(k - 1):
				out.append(2)
				n = n - 2
			out.append(n)
		else:
			for i in range(k - 1):
				out.append(1)
				n = n - 1
			out.append(n)
		print(*out, sep=' ')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n < k:
		print('NO')
	else:
		flag = 0
		for i in range(1, 10):
			j = k - 1
			if i & 1 and n - j * i & 1 and (n - j * i > 0):
				print('YES')
				flag = 1
				print(n - j * i, end=' ')
				for kk in range(2, k + 1):
					print(i, end=' ')
				print()
				break
			elif i % 2 == 0 and (n - j * i) % 2 == 0 and (n - j * i > 0):
				print('YES')
				flag = 1
				print(n - j * i, end=' ')
				for kk in range(2, k + 1):
					print(i, end=' ')
				print()
				break
		if flag == 0:
			print('NO')


t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	if k == 1:
		print('YES')
		print(n)
		continue
	A1 = [1] * k
	A2 = [2] * k
	A1[-1] = n - k + 1
	A2[-1] = n - (k - 1) * 2
	if A1[-1] > 0 and A1[-1] % 2 == 1:
		print('YES')
		for a in A1:
			print(a, end=' ')
		print()
	elif A2[-1] > 0 and A2[-1] % 2 == 0:
		print('YES')
		for a in A2:
			print(a, end=' ')
		print()
	else:
		print('NO')


try:
	t = int(input())
	while t:
		(n, k) = map(int, input().split())
		ne = n - 2 * (k - 1)
		no = n - (k - 1)
		if no > 0 and no % 2 != 0:
			print('YES')
			for i in range(k - 1):
				print('1 ', end='')
			print(no)
		elif ne > 0 and ne % 2 == 0:
			print('YES')
			for i in range(k - 1):
				print('2 ', end='')
			print(ne)
		else:
			print('NO')
		t = t - 1
except:
	pass


import collections, heapq, itertools, math
groupby = itertools.groupby
rs = lambda : input()
ri = lambda : int(input())
rm = lambda : map(int, input().split())
rai = lambda : [int(x) for x in input().split()]

def solve(n, k):
	ans = []
	ans2 = []
	c1 = c2 = k
	m = l = n
	while c1 > 1:
		ans.append(1)
		m -= 1
		c1 -= 1
	ans.append(m)
	while c2 > 1:
		ans2.append(2)
		l -= 2
		c2 -= 1
	ans2.append(l)
	if ans[-1] > 0 and ans[-1] % 2 and (len(ans) == k):
		return (True, ans)
	elif ans2[-1] > 0 and ans2[-1] % 2 == 0 and (len(ans2) == k):
		return (True, ans2)
	else:
		return (False, [])
for t in range(ri()):
	(n, k) = rm()
	(a, b) = solve(n, k)
	if a:
		print('YES')
		print(*b)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	if n % k == 0:
		print('YES')
		temp = n // k
		for x in range(k):
			print(temp, end=' ')
		print()
		continue
	if n == k:
		for x in range(k):
			print(1, end=' ')
		print()
		continue
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
		continue
	if n - k < 2:
		print('NO')
		continue
	if k % 2 == 0 and n % k % 2 == 1:
		print('NO')
		continue
	if n // k == 1 and k % 2 == 1 and (n % k % 2 == 1):
		print('NO')
		continue
	temp = n // k
	array = [temp] * k
	rem = n % k
	if rem % 2 == 0:
		for i in range(rem):
			if i % 2 == 0:
				array[i] += 2
	else:
		for i in range(k):
			if i < rem:
				array[i] += 1
			elif i % 2 == 0:
				array[i] += 1
			else:
				array[i] -= 1
	print('YES')
	for x in array:
		print(x, end=' ')
	print()


def parity(n, k):
	if n == k:
		array = [1] * k
		print('YES')
		print(*array)
	elif n < k:
		print('NO')
	elif n % 2 != 0:
		if k % 2 == 0:
			print('NO')
		else:
			array = [1] * (k - 1)
			array.append(n - (k - 1))
			print('YES')
			print(*array)
	elif k % 2 != 0:
		if k * 2 <= n:
			array = [2] * (k - 1)
			array.append(n - 2 * (k - 1))
			print('YES')
			print(*array)
		else:
			print('NO')
	else:
		array = [1] * (k - 1)
		array.append(n - (k - 1))
		print('YES')
		print(*array)
t = int(input())
for i in range(t):
	(n, k) = list(map(int, input().split()))
	parity(n, k)


k = int(input())
a = []
for i in range(0, k):
	(num1, num2) = [int(x) for x in input().split()]
	if num2 > num1:
		num1 = 3
		num2 = 2
	a.append([num1, num2])
for i in a:
	(num1, num2) = i
	arr = []
	odd_index = []
	even_index = []
	for j in range(0, num2):
		arr.append(int(num1 / num2))
		if j == num2 - 1:
			arr[-1] = arr[-1] + num1 % num2
		even_index.append(j) if arr[j] % 2 == 0 else odd_index.append(j)
	if len(odd_index) == 0 or len(even_index) == 0:
		print('YES')
		print(*arr)
	elif len(odd_index) == len(even_index):
		print('NO')
	elif len(odd_index) % 2 == 0 and arr[0] != 1:
		for k in range(0, int(len(odd_index) / 2)):
			arr[odd_index[k]] += 1
			arr[odd_index[len(odd_index) - 1 - k]] -= 1
		print('YES')
		print(*arr)
	elif len(even_index) % 2 == 0:
		for k in range(0, int(len(even_index) / 2)):
			arr[even_index[k]] += 1
			arr[even_index[len(even_index) - 1 - k]] -= 1
		print('YES')
		print(*arr)
	else:
		print('NO')


def R():
	return map(int, input().split())
t = int(input())
while t:
	(n, k) = R()
	if n & 1 and (not k & 1):
		print('NO')
		t -= 1
		continue
	if n & 1 == k & 1:
		val = n - k + 1
		if val <= 0:
			print('NO')
			t -= 1
			continue
		print('YES')
		print(val, end=' ')
		for i in range(k - 1):
			print(1, end=' ')
		print()
		t -= 1
		continue
	val = n - (k - 1) * 2
	if val <= 0:
		print('NO')
		t -= 1
		continue
	print('YES')
	print(val, end=' ')
	for i in range(k - 1):
		print(2, end=' ')
	print()
	t -= 1


def solve(n, k):
	diff_odd = n - (k - 1)
	diff_even = n - 2 * (k - 1)
	if diff_odd > 0 and diff_odd % 2 == 1:
		return [1] * (k - 1) + [diff_odd]
	if diff_even > 0 and diff_even % 2 == 0:
		return [2] * (k - 1) + [diff_even]
	return None
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	sol = solve(n, k)
	print('YES' if sol else 'NO')
	if sol:
		print(' '.join(map(str, sol)))


for test in range(0, int(input())):
	(n, k) = [int(x) for x in input().split()]
	sum1 = k - 1
	key = 0
	if n - sum1 > 0 and (n - sum1) % 2 != 0:
		print('YES')
		print(*list((1 for i in range(0, k - 1))), n - sum1)
		key = 1
	if key == 0:
		sum2 = (k - 1) * 2
		if n - sum2 > 0 and (n - sum2) % 2 == 0:
			print('YES')
			print(*list((2 for i in range(0, k - 1))), n - sum2)
			key = 1
	if key == 0:
		print('NO')


for i in range(int(input())):
	(n, k) = map(int, input().split())
	l1 = []
	l2 = []
	if n >= k:
		for i in range(k - 1):
			l1.append(1)
		l1.append(n - k + 1)
		for i in range(k - 1):
			l2.append(2)
		l2.append(n - 2 * (k - 1))
		if l1[k - 1] & 1:
			print('YES')
			for i in l1:
				print(i, end=' ')
			print()
		elif l2[k - 1] > 0 and l2[k - 1] % 2 == 0:
			print('YES')
			for i in l2:
				print(i, end=' ')
			print()
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
for j in range(t):
	(n, k) = map(int, input().split(' '))
	a = []
	if n < k:
		print('NO')
	else:
		if n % k == 0:
			a = [int(n / k)] * k
		elif (n - (k - 1) * 1) % 2 == 1 and n - (k - 1) * 1 > 0:
			a = [1] * (k - 1) + [n - (k - 1)]
		elif (n - (k - 1) * 2) % 2 == 0 and n - (k - 1) * 2 > 0:
			a = [2] * (k - 1) + [n - (k - 1) * 2]
		if a != []:
			print('YES')
			print(*a, sep=' ')
		else:
			print('NO')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	d = n // k
	if d < 1:
		print('NO')
	else:
		a1 = [d for i in range(k - 1)]
		a2 = [d - 1 for i in range(k - 1)]
		if d % 2 == (n - sum(a1)) % 2:
			print('YES')
			a1.append(n - sum(a1))
			print(*a1)
		elif d > 1 and (d - 1) % 2 == (n - sum(a2)) % 2:
			print('YES')
			a2.append(n - sum(a2))
			print(*a2)
		else:
			print('NO')


def div4_2(n, k):
	if n < k:
		print('NO')
	elif n % 2 == 1 and k % 2 == 0:
		print('NO')
	elif n % 2 == 1 and k % 2 == 1:
		print('YES')
		I = (k - 1) * [1] + [n - k + 1]
		print(*I)
	elif n % 2 == 0 and k % 2 == 0:
		print('YES')
		I = (k - 1) * [1] + [n - k + 1]
		print(*I)
	elif n % 2 == 0 and k % 2 == 1:
		if n - 2 * k + 2 <= 0:
			print('NO')
		else:
			print('YES')
			I = (k - 1) * [2] + [n - 2 * k + 2]
			print(*I)
t = int(input())
for i in range(t):
	s = input()
	I = s.split()
	n = int(I[0])
	k = int(I[1])
	div4_2(n, k)


t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	n1 = n - (k - 1)
	if n1 > 0 and n1 & 1:
		print('YES')
		res = [1 for _ in range(k - 1)]
		res.append(n1)
		print(*res)
		continue
	n2 = n - 2 * (k - 1)
	if n2 > 0 and n2 % 2 == 0:
		print('YES')
		res = [2 for _ in range(k - 1)]
		res.append(n2)
		print(*res)
		continue
	print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
		continue
	if n % 2 == k % 2:
		if k > n:
			print('NO')
			continue
		res = [1] * (k - 1)
		res.append(n - (k - 1))
		print('YES')
		print(*res)
		continue
	if k * 2 > n:
		print('NO')
		continue
	res = [2] * (k - 1)
	res.append(n - (k - 1) * 2)
	print('YES')
	print(*res)


def iinput():
	return [int(i) for i in input().split()]
t = int(input())
for _ in range(t):
	(n, k) = iinput()
	if k == 1:
		print('YES')
		print(n)
		continue
	elif k == n:
		print('YES')
		print(*[1 for _ in range(n)])
		continue
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
	else:
		ans = []
		if n % 2 == 0 and k % 2 == 1:
			ans = [2 for _ in range(k - 1)]
			ans += [n - 2 * (k - 1)]
		elif n % 2 == 0 and k % 2 == 0:
			ans = [1 for _ in range(k - 1)]
			ans += [n - k + 1]
		elif n % 2 == 1 and k % 2 == 1:
			ans = [1 for _ in range(k - 1)]
			ans += [n - k + 1]
		if ans[-1] > 0:
			print('YES')
			print(*ans)
		else:
			print('NO')


tc = int(input())
while tc != 0:
	tc = tc - 1
	(n, k) = map(int, input().split(' '))
	a = []
	if n % 2 == 0:
		if k % 2 == 0:
			for i in range(0, k - 1):
				a.append(1)
			if n - (k - 1) <= 0:
				print('NO')
				continue
			a.append(n - (k - 1))
		else:
			for i in range(0, k - 1):
				a.append(2)
			if n - 2 * (k - 1) <= 0:
				print('NO')
				continue
			a.append(n - 2 * (k - 1))
	elif k % 2 == 0:
		print('NO')
		continue
	else:
		for i in range(0, k - 1):
			a.append(1)
		if n - (k - 1) <= 0:
			print('NO')
			continue
		a.append(n - (k - 1))
	print('YES')
	for i in a:
		print(i, end=' ')
	print()


for i in range(int(input())):
	(n, s) = map(int, input().split())
	c = 0
	if n % 2 == 1 and s % 2 == 0 or s > n:
		print('NO')
	else:
		l = []
		if n % 2 == 0 and s % 2 == 1:
			while s >= 2:
				l.append(2)
				c = c + 2
				s = s - 1
				if n - c <= 0:
					c = n - 1
					break
			if (n - c) % 2 == 1:
				print('NO')
			else:
				print('YES')
				for i in l:
					print(i, end=' ')
				print(n - c)
		else:
			while s >= 2:
				l.append(1)
				c = c + 1
				s = s - 1
			if (n - c) % 2 == 0:
				print('NO')
			else:
				print('YES')
				for i in l:
					print(i, end=' ')
				print(n - c)


from collections import defaultdict as dc
from collections import Counter
from heapq import *
import math
from bisect import bisect_left, bisect
import sys
from collections import deque as dq
from heapq import heapify, heappush, heappop
mod = 10 ** 9 + 7

def sinp():
	p = str(input())
	return p

def inp():
	p = int(input())
	return p

def line():
	p = list(map(int, input().split()))
	return p

def read_mat():
	n = inp()
	a = []
	for i in range(n):
		a.append(line())
	return a

def digit(n):
	s = str(n)
	p = 0
	for i in s:
		p += int(i) ** 2
	return p

def check(p, i, j):
	z = i + (j - i) // 2
	if p[z] - p[i] == p[j] - p[z]:
		return j - i
	return 0

def solve(n, k):
	ans = []
	s = 0
	v = 0
	if n % 2 == k % 2:
		for i in range(k - 1):
			ans.append(1)
		s = k - 1
		if n - s <= 0 or (n - s) % 2 == 0:
			return ('NO', [])
		ans.append(n - s)
		return ('YES', ans)
	else:
		for i in range(k - 1):
			ans.append(2)
		s = 2 * (k - 1)
		if n - s <= 0 or (n - s) % 2 != 0:
			return ('NO', [])
		ans.append(n - s)
		return ('YES', ans)
for test in range(inp()):
	(n, k) = line()
	(l, r) = solve(n, k)
	print(l)
	if l == 'YES':
		print(*r)


t = input()
t = int(t)
shetchikshetchikov1 = 0
while shetchikshetchikov1 < t:
	(n, k1) = input().split()
	n = int(n)
	k1 = int(k1)
	a = []
	k = 1
	r = 0
	if n == k1:
		print('YES')
		while k <= k1:
			a.append(1)
			k = k + 1
		print(*a)
	else:
		if n % 2 == 0:
			while k <= k1:
				if k != k1:
					if n % 2 == 0 and k1 % 2 == 0:
						a.append(1)
						r = r + 1
					else:
						a.append(2)
						r = r + 2
				else:
					c = n - r
					a.append(c)
				k = k + 1
		else:
			while k <= k1:
				if k != k1:
					a.append(1)
					r = r + 1
				else:
					c = n - r
					a.append(c)
				k = k + 1
		if n % 2 == 1 and k1 % 2 == 0 or n < k1 or n - 1 == k1 or (a[-1] <= 0):
			if k1 != 1:
				print('NO')
			else:
				print('YES')
				print(n)
		else:
			print('YES')
			print(*a)
	shetchikshetchikov1 = shetchikshetchikov1 + 1


t = int(input())
out = ''
while t > 0:
	t -= 1
	(n, k) = [int(i) for i in input().split(' ')]
	if k > n:
		out += 'NO\n'
	elif n - (k - 1) > 0 and (n - (k - 1)) % 2 == 1:
		out += 'YES\n'
		out += ' '.join(('1' for _ in range(k - 1)))
		out += f' {n - (k - 1)}\n'
	elif n - (k - 1) * 2 > 1 and (n - (k - 1) * 2) % 2 == 0:
		out += 'YES\n'
		out += ' '.join(('2' for _ in range(k - 1)))
		out += f' {n - (k - 1) * 2}\n'
	else:
		out += 'NO\n'
print(out)


from sys import stdout, stdin
import io
import os
input = stdin.readline
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = n - 2 * (k - 1)
	b = n - (k - 1)
	if a % 2 == 0 and a > 0:
		stdout.write('YES\n')
		stdout.write('2 ' * (k - 1) + str(a) + '\n')
	elif b % 2 == 1 and b > 0:
		stdout.write('YES\n')
		stdout.write('1 ' * (k - 1) + str(b) + '\n')
	else:
		stdout.write('NO\n')


import math
import sys
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
	elif n % 2 == 0:
		if k % 2 == 0:
			print('YES')
			arr = [1] * (k - 1)
			arr.append(n - k + 1)
			print(*arr)
		elif 2 * k <= n:
			print('YES')
			arr = [2] * (k - 1)
			arr.append(n - 2 * (k - 1))
			print(*arr)
		else:
			print('NO')
	elif k % 2 == 1:
		print('YES')
		arr = [1] * (k - 1)
		arr.append(n - k + 1)
		print(*arr)
	else:
		print('NO')


def solve():
	(n, k) = list(map(int, input().split()))
	can = False
	res = []
	if k % 2 == 0 and n % 2 == 0:
		if 2 * k <= n:
			can = True
			res = ['2'] * (k - 1)
			res.append(str(n - (k - 1) * 2))
		elif k <= n:
			can = True
			res = ['1'] * (k - 1)
			res.append(str(n - k + 1))
	elif k % 2 == 1 and n % 2 == 0:
		if 2 * k <= n:
			can = True
			res = ['2'] * (k - 1)
			res.append(str(n - (k - 1) * 2))
	elif k % 2 == 1 and n % 2 == 1:
		if k <= n:
			can = True
			res = ['1'] * (k - 1)
			res.append(str(n - k + 1))
	print('YES' if can else 'NO')
	if can:
		print(' '.join(res))

def main():
	t = int(input())
	for _ in range(t):
		solve()
main()


lst = [map(int, input().split()) for _ in range(int(input()))]
for (value, num) in lst:
	if num > value:
		print('NO')
	elif (value + 1 - num) % 2 == 1:
		if value - num + 1 > 0:
			print('YES')
			print(*[1] * (num - 1) + [value - num + 1])
		else:
			print('NO')
	elif (value - 2 * (num - 1)) % 2 == 0:
		if value - 2 * num + 2 > 0:
			print('YES')
			print(*[2] * (num - 1) + [value - 2 * num + 2])
		else:
			print('NO')
	else:
		print('NO')


def next(a, b):
	t = b - 1
	temp = a - 2 * t
	if temp % 2 == 0 and temp > 0:
		print('YES')
		for i in range(t):
			print(2, end=' ')
		print(temp)
	else:
		temp = a - t
		if temp % 2 != 0 and temp > 0:
			print('YES')
			for i in range(t):
				print(1, end=' ')
			print(temp)
		else:
			print('NO')
	return
m = int(input())
for t in range(m):
	(a, b) = map(int, input().split())
	next(a, b)


tests = int(input())
while tests:
	(n, k) = [int(x) for x in input().split()]
	n1 = n - (k - 1)
	n2 = n - 2 * (k - 1)
	if n1 > 0 and n1 % 2 == 1:
		print('YES')
		for i in range(k - 1):
			print('1')
		print(n1)
	elif n2 > 0 and n2 % 2 == 0:
		print('YES')
		for i in range(k - 1):
			print('2')
		print(n2)
	else:
		print('NO')
	tests -= 1


n = int(input())
for i in range(n):
	(k, g) = [int(el) for el in input().split()]
	if g % 2 == 0 and k % 2 == 1 or g > k or (2 * g > k and g % 2 == 1 and (k % 2 == 0)):
		print('NO')
	else:
		print('YES')
		print(' '.join([str(1 + (k % 2 == 0 and g % 2 == 1))] * (g - 1) + [str(k - (1 + (k % 2 == 0 and g % 2 == 1)) * (g - 1))]))


t = int(input())
while t:
	t -= 1
	(n, k) = map(int, input().split(' '))
	n1 = n - (k - 1)
	if n1 % 2 == 1 and n1 > 0:
		print('YES')
		print('1 ' * (k - 1), end='')
		print(n1)
		continue
	n2 = n - 2 * (k - 1)
	if n2 % 2 == 0 and n2 > 0:
		print('YES')
		print('2 ' * (k - 1), end='')
		print(n2)
		continue
	print('NO')


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key, lru_cache
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
M = mod = 10 ** 9 + 7

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip().split()]

def st():
	return str(input().rstrip())[2:-1]

def val():
	return int(input().rstrip())

def li2():
	return [str(i)[2:-1] for i in input().rstrip().split()]

def li3():
	return [int(str(i)[2:-1]) for i in input().rstrip()]

def check(l, n):
	l.sort()
	for i in range(1, len(l)):
		if l[i] & 1 != l[i - 1] & 1:
			return 0
	if sum(l) != n or min(l) < 1:
		return 0
	return 1
for _ in range(val()):
	(n, k) = li()
	if k > n:
		print('NO')
		continue
	if k == 1:
		print('YES')
		print(n)
		continue
	l2 = []
	l1 = [1] * (k - 1)
	l1.append(n - sum(l1))
	l2 = [2] * (k - 1)
	l2.append(n - sum(l2))
	if check(l1, n):
		print('YES')
		print(*l1)
	elif check(l2, n):
		print('YES')
		print(*l2)
	else:
		print('NO')


for t in range(int(input())):
	(n, k) = map(int, input().split(' '))
	ans = [n - (k - 1)] + [1] * (k - 1)
	if ans[0] > 0 and (len(ans) <= 1 or ans[0] % 2 == 1):
		print('Yes')
		print(' '.join((str(v) for v in ans)))
		continue
	ans = [n - 2 * (k - 1)] + [2] * (k - 1)
	if ans[0] > 0 and (len(ans) <= 1 or ans[0] % 2 == 0):
		print('Yes')
		print(' '.join((str(v) for v in ans)))
		continue
	print('No')


for i in range(int(input())):
	(n, k) = list(map(int, input().split()))
	if n < k:
		print('no')
	elif n == k:
		t = [1] * n
		print('yes')
		print(*t)
	elif n % 2 != 0:
		if k % 2 == 0:
			print('no')
		else:
			t = [1] * (k - 1)
			t.append(n - k + 1)
			print('yes')
			print(*t)
	else:
		n_n = n // 2
		if k % 2 != 0:
			if n_n < k:
				print('no')
			else:
				t = [2] * (k - 1)
				t.append(n - (k - 1) * 2)
				print('yes')
				print(*t)
		elif n < k:
			print('no')
		else:
			t = [1] * (k - 1)
			t.append(n - (k - 1) * 1)
			print('yes')
			print(*t)


import sys, math
tc = int(sys.stdin.readline())
for _ in range(tc):
	(n, k) = map(int, sys.stdin.readline().split())
	if n % 2 == 0:
		if k % 2 == 0:
			arr = [1] * k
			cnt = 0
			for i in range(k - 1):
				cnt += arr[i]
			arr[-1] = n - cnt
			if arr[-1] > 0 and arr[-1] % 2 == 1:
				print('YES')
				print(' '.join(map(str, arr)))
			else:
				print('NO')
		else:
			arr = [2] * k
			cnt = 0
			for i in range(k - 1):
				cnt += arr[i]
			arr[-1] = n - cnt
			if arr[-1] > 0 and arr[-1] % 2 == 0:
				print('YES')
				print(' '.join(map(str, arr)))
			else:
				print('NO')
	else:
		arr = [1] * k
		cnt = 0
		for i in range(k - 1):
			cnt += arr[i]
		arr[-1] = n - cnt
		if arr[-1] > 0 and arr[-1] % 2 == 1:
			print('YES')
			print(' '.join(map(str, arr)))
		else:
			print('NO')


T = int(input())
for _ in range(T):
	(n, m) = map(int, input().split())
	ok = 0
	total = (m - 1) * 1
	if (n - total) % 2 == 1 and n - total > 0:
		ok = 1
	total = (m - 1) * 2
	if (n - total) % 2 == 0 and n - total > 0:
		ok = 2
	if ok == 0:
		print('NO')
	else:
		print('YES')
		for i in range(m - 1):
			print(ok, end=' ')
		print(n - (m - 1) * ok)


import sys
input = lambda : sys.stdin.readline().strip()
t = int(input())
while t:
	t -= 1
	(n, k) = map(int, input().split())
	if k % 2 == 0 and n % 2:
		print('NO')
		continue
	if n % 2 == 0 and k % 2 == 1:
		if n < 2 * k:
			print('NO')
			continue
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		print(n - 2 * (k - 1))
	else:
		if n < k:
			print('NO')
			continue
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(n - (k - 1))


def samands(n, k):
	ans = []
	if n - k + 1 > 0 and (n - k + 1) % 2 == 1:
		for i in range(k - 1):
			ans.append(1)
		ans.append(n - (k - 1))
		return ans
	elif n - 2 * (k - 1) > 0 and (n - 2 * (k - 1)) % 2 == 0:
		for i in range(k - 1):
			ans.append(2)
		ans.append(n - 2 * (k - 1))
		return ans
	else:
		return 'NO'

def main(n, k):
	x = samands(n, k)
	if x == 'NO':
		print('NO')
	else:
		print('YES')
		for i in x:
			print(i, end=' ')
		print('')
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	main(n, k)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	all_odd = n - (k - 1)
	all_even = n - 2 * (k - 1)
	out = []
	if all_odd % 2 != 0 and all_odd > 0:
		for j in range(k - 1):
			out.append(1)
		out.append(n - (k - 1))
		print('YES')
		print(*out)
	elif all_even % 2 == 0 and all_even > 0:
		for j in range(k - 1):
			out.append(2)
		out.append(n - 2 * (k - 1))
		print('YES')
		print(*out)
	else:
		print('NO')


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a % 2 == b % 2:
		if b > a:
			print('NO')
		else:
			print('YES')
			for i in range(b - 1):
				print(1, end=' ')
				a -= 1
			print(a)
	elif a % 2 or 2 * b > a:
		print('NO')
	else:
		print('YES')
		if b - 1 == 1:
			print(a)
			continue
		for i in range(b - 1):
			print(2, end=' ')
			a -= 2
		print(a)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n < k:
		print('NO')
	else:
		a = [2] * (k - 1)
		r = n - 2 * (k - 1)
		if r % 2 == 0 and r > 1:
			a.append(r)
			print('YES')
			print(*a)
		else:
			a = [1] * (k - 1)
			r = n - (k - 1)
			if r % 2 != 0 and r >= 1:
				a.append(r)
				print('YES')
				print(*a)
			else:
				print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n - k >= 0:
		ans1 = [1] * (k - 1) + [n - k + 1]
		if ans1[0] % 2 == ans1[-1] % 2:
			print('YES')
			print(' '.join((str(x) for x in ans1)))
			continue
	if n - 2 * k >= 0:
		ans2 = [2] * (k - 1) + [n - 2 * k + 2]
		if ans2[0] % 2 == ans2[-1] % 2:
			print('YES')
			print(' '.join((str(x) for x in ans2)))
			continue
	print('NO')


import sys
input = sys.stdin.readline
t = int(input())
for i1 in range(t):
	(n, k) = list(map(int, input().split(' ')))
	arr = [0] * k
	fl = 0
	for i in range(k):
		arr[i] = n // k
		if i == k - 1:
			arr[i] += n % k
	z = 'YES'
	if len(arr) > 1:
		if arr[-1] % 2 != arr[-2] % 2:
			fl = 0
			for i in range(0, k - 1, 2):
				arr[i] += 1
				arr[i + 1] -= 1
				if arr[i + 1] == 0:
					fl = 1
		if arr[-1] % 2 != arr[-2] % 2 or fl == 1 or k > n:
			print('NO')
		else:
			print('YES')
			s = ''
			for i in range(k):
				s += str(arr[i]) + ' '
			print(s)
	else:
		print(z)
		print(arr[0])


import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub
import sys
buff_readline = sys.stdin.buffer.readline
readline = sys.stdin.readline
INF = 2 ** 62 - 1

def read_int():
	return int(buff_readline())

def read_int_n():
	return list(map(int, buff_readline().split()))

def read_float():
	return float(buff_readline())

def read_float_n():
	return list(map(float, buff_readline().split()))

def read_str():
	return readline().strip()

def read_str_n():
	return readline().strip().split()

def error_print(*args):
	print(*args, file=sys.stderr)

def slv(N, K):
	if N % 2 == 1 and K % 2 == 0:
		return 'NO'
	ans = [1] * K
	M = N - sum(ans)
	if M >= 0 and M % 2 == 0:
		ans[0] += M
		return 'YES\n' + ' '.join(map(str, ans))
	ans = [2] * K
	M = N - sum(ans)
	if M >= 0 and M % 2 == 0:
		ans[0] += M
		return 'YES\n' + ' '.join(map(str, ans))
	return 'NO'

def main():
	T = read_int()
	for _ in range(T):
		(N, K) = read_int_n()
		print(slv(N, K))
main()


import sys
import math
from collections import defaultdict
mod = 1000000007
T = 1
T = int(sys.stdin.readline())
for _ in range(T):
	(n, k) = map(int, input().split())
	ans = []
	flg = 0
	s = 0
	if n & 1:
		for i in range(k - 1):
			ans.append(1)
			s += 1
		if s >= n or (s - n) % 2 == 0:
			flg = 1
		else:
			ans.append(n - s)
	elif k & 1:
		for i in range(k - 1):
			ans.append(2)
			s += 2
		if s >= n:
			flg = 1
		else:
			ans.append(n - s)
	elif n < k:
		flg = 1
	else:
		for i in range(k - 1):
			ans.append(1)
			s += 1
		if s >= n:
			flg = 1
		else:
			ans.append(n - s)
	if flg:
		print('NO')
	else:
		print('YES')
		print(*ans)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	(even, odd) = ([], [])
	(o, e) = (n, n)
	for i in range(1, k + 1):
		if e >= 2 and i < k:
			even.append(2)
			e -= 2
		if i == k and e > 0:
			even.append(e)
	for i in range(1, k + 1):
		if o >= 1 and i < k:
			odd.append(1)
			o -= 1
		if i == k and o > 0:
			odd.append(o)
	odd_ = len(odd)
	even_ = len(even)
	if odd[odd_ - 1] & 1 and odd_ == k:
		print('YES')
		for i in range(odd_):
			print(odd[i], end=' ')
	elif even[even_ - 1] % 2 == 0 and even_ == k:
		print('YES')
		for i in range(even_):
			print(even[i], end=' ')
	else:
		print('NO')
	print('\n')


def solve():
	(n, k) = map(int, input().split(' '))
	if n < k:
		print('NO')
		return
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
		return
	res = []
	if (n - (k - 1)) % 2 == 1 and n - (k - 1) > 0:
		res = [n - (k - 1)] + [1 for _ in range(k - 1)]
	if (n - 2 * (k - 1)) % 2 == 0 and n - 2 * (k - 1) > 0:
		res = [n - 2 * (k - 1)] + [2 for _ in range(k - 1)]
	if len(res) > 0:
		print('YES')
		print(' '.join(map(str, res)))
	else:
		print('NO')
	return
t = int(input())
for _ in range(t):
	solve()


import math
t = int(input())
while t:
	t -= 1
	(n, k) = map(int, input().split())
	if n % 2:
		if k % 2 == 0:
			print('NO')
			continue
		elif n < k:
			print('NO')
			continue
		else:
			print('YES')
			for i in range(k - 1):
				print(1, end=' ')
			print(n - k + 1)
	elif k % 2:
		if n < 2 * k:
			print('NO')
			continue
		else:
			print('YES')
			for i in range(k - 1):
				print(2, end=' ')
			print(n - 2 * (k - 1))
	elif n < k:
		print('NO')
		continue
	else:
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(n - k + 1)


from math import *

def main():
	for _ in range(int(input())):
		(n, k) = map(int, input().split())
		if 2 * k <= n and n % 2 == 0:
			print('yes')
			print(n - 2 * (k - 1), end=' ')
			for i in range(k - 1):
				print(2, end=' ')
			print()
		elif k <= n and (n + k) % 2 != 1:
			print('yes')
			print(n - (k - 1), end=' ')
			for i in range(k - 1):
				print(1, end=' ')
			print()
		else:
			print('no')
main()


tests = int(input())
for _ in range(tests):
	(n, k) = [int(x) for x in input().split()]
	if n - (k - 1) > 0 and (n - (k - 1)) % 2 == 1:
		print('YES', '\n', '1 ' * (k - 1), n - (k - 1), sep='')
	elif n - 2 * (k - 1) > 0 and (n - 2 * (k - 1)) % 2 == 0:
		print('YES', '\n', '2 ' * (k - 1), n - 2 * (k - 1), sep='')
	else:
		print('NO')


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return map(int, input().split())

def array():
	return [int(i) for i in input().split()]
for _ in range(int(input())):
	(n, k) = value()
	ans = []
	if k > n:
		print('NO')
		continue
	if n % 2 == 1:
		if k % 2 == 0:
			print('NO')
		else:
			ans = [1] * (k - 1)
			ans.append(n - k + 1)
			print('YES')
			print(*ans)
	elif k % 2 == 0:
		ans = [1] * (k - 1)
		n -= k - 1
		if n <= 0:
			print('NO')
		else:
			ans.append(n)
			print('YES')
			print(*ans)
	else:
		ans = [2] * (k - 1)
		n -= 2 * (k - 1)
		if n <= 0:
			print('NO')
		else:
			ans.append(n)
			print('YES')
			print(*ans)


def summands(n, k):
	if n < k:
		return []
	if n & 1:
		if k & 1:
			return [1 for _ in range(k - 1)] + [n - k + 1]
	elif k & 1:
		if n - 2 * (k - 1) > 0:
			return [2 for _ in range(k - 1)] + [n - 2 * (k - 1)]
	else:
		return [1 for _ in range(k - 1)] + [n - k + 1]
	return []

def solve():
	(n, k) = map(int, input().split())
	s = summands(n, k)
	if s:
		print('YES')
		print(*s)
	else:
		print('NO')
for _ in range(int(input())):
	solve()


import random
import math
LI = lambda : list(map(int, input().split()))
MI = lambda : map(int, input().split())
yes = lambda : print('Yes')
no = lambda : print('No')
I = lambda : list(input())
J = lambda x: ''.join(x)
II = lambda : int(input())
SI = lambda : input()
t = II()
for i in range(t):
	(n, k) = MI()
	if k > n:
		no()
	elif n % k == 0:
		a = [n // k] * k
		yes()
		print(*a)
	elif n % 2 == 1:
		if k % 2 == 0:
			no()
		else:
			a = [1] * (k - 1) + [n - k + 1]
			yes()
			print(*a)
	elif n % 2 == 0:
		if k % 2 == 1:
			if n // k < 2:
				no()
			else:
				a = [2] * (k - 1) + [n - 2 * k + 2]
				yes()
				print(*a)
		else:
			a = [1] * (k - 1) + [n - k + 1]
			yes()
			print(*a)


t = int(input())
for tests in range(t):
	[n, k] = input().split()
	n = int(n)
	k = int(k)
	if n % 2 == 1:
		n_odd = n - k
		if n_odd % 2 == 1 or n_odd < 0:
			print('NO')
		else:
			print('YES')
			for i in range(k - 1):
				print('1', end=' ')
			print(int(n_odd + 1))
	else:
		n_even = n / 2
		if n_even < k:
			n_odd = n - k
			if n_odd % 2 == 1 or n_odd < 0:
				print('NO')
			else:
				print('YES')
				for i in range(k - 1):
					print('1', end=' ')
				print(int(n_odd + 1))
		else:
			print('YES')
			for i in range(k - 1):
				print('2', end=' ')
			n_even -= k - 1
			print(int(2 * n_even))


def solve(n, k):
	if n % 2 == k % 2:
		if n >= k:
			return [1] * (k - 1) + [n - k + 1]
		return None
	if n % 2 == 0 and n >= 2 * k:
		return [2] * (k - 1) + [n - 2 * k + 2]
	return None
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = solve(n, k)
	if a is None:
		print('NO')
	else:
		print('YES')
		print(*a)


for t in range(int(input())):
	(n, k) = map(int, input().split())
	(a, b) = (n - (k - 1), n - 2 * (k - 1))
	if a > 0 and a % 2 == 1:
		l = [a] + [1] * (k - 1)
		print('YES')
		print(*l)
	elif b > 0 and b % 2 == 0:
		l = [b] + [2] * (k - 1)
		print('YES')
		print(*l)
	else:
		print('NO')


def check(arr, n):
	parity = arr[0] & 1
	return arr[-1] > 0 and sum(arr) == n and (not any([x for x in arr if x & 1 != parity]))
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	tempOdd = [1 for x in range(k - 1)] + [n - k + 1]
	tempEven = [2 for x in range(k - 1)] + [n - 2 * (k - 1)]
	if check(tempOdd, n):
		print('YES')
		for x in tempOdd:
			print(x, end=' ')
		print()
	elif check(tempEven, n):
		print('YES')
		for x in tempEven:
			print(x, end=' ')
		print()
	else:
		print('NO')


def gcd(a, b):
	return b if a % b == 0 else gcd(b, a % b)

def Odd(x, y):
	res = []
	flag1 = True
	res += ['1'] * (y - 1)
	x -= y - 1
	if x <= 0 or not x & 1:
		flag1 = False
	else:
		res += [str(x)]
	return (flag1, res)

def Even(x, y):
	res = []
	flag1 = True
	res += ['2'] * (y - 1)
	x -= (y - 1) * 2
	if x <= 0 or x & 1:
		flag1 = False
	else:
		res += [str(x)]
	return (flag1, res)
for case in range(int(input())):
	(n, k) = list(map(int, input().split()))
	ans = []
	flag = True
	if k > n:
		print('NO')
		continue
	if n & 1 or (not n & 1 and (not k & 1)):
		(flag, ans) = Odd(n, k)
	elif not n & 1 and k & 1:
		(flag, ans) = Even(n, k)
	if flag:
		print('YES')
		print(' '.join(list(ans)))
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().rstrip().split())
	n1 = n - (k - 1)
	if n1 % 2 != 0 and n1 > 0:
		print('YES')
		for pos in range(k - 1):
			print('1', end=' ')
		print(n1)
		continue
	n2 = n - 2 * (k - 1)
	if n2 % 2 == 0 and n2 > 0:
		print('YES')
		for pos in range(k - 1):
			print('2', end=' ')
		print(n2)
		continue
	print('NO')


def even(x):
	return not x & 1

def odd(x):
	return not even(x)
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if even(n) == even(k):
		if n < k:
			print('NO')
		else:
			print('YES')
			r = [1] * (k - 1)
			print(n - sum(r), *r)
	elif odd(n):
		print('NO')
	elif n < 2 * k:
		print('NO')
	else:
		print('YES')
		r = [2] * (k - 1)
		print(n - sum(r), *r)


from sys import stdin, stdout
import heapq
import cProfile, math
from collections import Counter, defaultdict, deque
from bisect import bisect_left, bisect, bisect_right
import itertools
from copy import deepcopy
from fractions import Fraction
import sys, threading
import operator as op
from functools import reduce
import sys

def get_int():
	return int(stdin.readline().strip())

def get_tuple():
	return map(int, stdin.readline().split())

def get_list():
	return list(map(int, stdin.readline().split()))

def solve():
	(n, k) = get_tuple()
	if n % 2 != 0 and k % 2 == 0:
		print('NO')
	elif n % 2 == 0 and k % 2 != 0:
		if n < 2 * k:
			print('NO')
		else:
			print('YES')
			ans = [2] * (k - 1)
			ans.append(n - sum(ans))
			print(*ans)
	elif n % 2 != 0 and k % 2 != 0:
		if n < k:
			print('NO')
		elif n == k:
			print('YES')
			ans = [1] * k
			print(*ans)
		else:
			print('YES')
			ans = [1] * (k - 1)
			ans.append(n - sum(ans))
			print(*ans)
	elif n < k:
		print('NO')
	elif n == k:
		print('YES')
		ans = [1] * k
		print(*ans)
	elif k < n < 2 * k:
		ans = [1] * (k - 1)
		ans.append(n - sum(ans))
		print('YES')
		print(*ans)
	else:
		print('YES')
		ans = [2] * (k - 1)
		ans.append(n - sum(ans))
		print(*ans)

def main():
	solve()
TestCases = True
if TestCases:
	for i in range(get_int()):
		main()
else:
	main()


for num in range(int(input())):
	(n, k) = map(int, input().split())
	if n >= k:
		if n % 2 == k % 2:
			print('YES')
			print('1 ' * (k - 1), end='')
			print(n - (k - 1))
		elif n % 2 == 1:
			print('NO')
		elif k * 2 > n:
			print('NO')
		else:
			print('YES')
			print('2 ' * (k - 1), end='')
			print(n - 2 * (k - 1))
	else:
		print('NO')


def check(x, k, on):
	ans = []
	summ = 0
	while k > 0:
		if k == 1:
			if on == 2:
				on = 0
			val = x - summ
			if val <= 0:
				return (False, [])
			elif val % 2 == on:
				ans.append(val)
				return (True, ans)
			else:
				return (False, [])
		k -= 1
		summ += on
		ans.append(on)
t = int(input())
while t > 0:
	t -= 1
	inp = input()
	(x, k) = inp.split(' ')
	x = int(x)
	k = int(k)
	(o1, l1) = check(x, k, 1)
	if o1:
		print('YES')
		for v in l1:
			print(v, end=' ')
		print()
	else:
		(o2, l2) = check(x, k, 2)
		if o2:
			print('YES')
			for v in l2:
				print(v, end=' ')
			print()
		else:
			print('NO')


import sys
input = sys.stdin.readline
t = int(input())
for r in range(t):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
	elif (n - k) % 2 == 0:
		print('YES')
		print(1 + (n - k), end=' ')
		for i in range(k - 1):
			print(1, end=' ')
		print()
	elif (n - 2 * k) % 2 == 0 and n - 2 * k >= 0:
		print('YES')
		print(2 + (n - 2 * k), end=' ')
		for i in range(k - 1):
			print(2, end=' ')
		print()
	else:
		print('NO')


from sys import stdin
input = stdin.readline

def main():
	test = int(input())
	for t in range(test):
		l = [int(i) for i in input().split(' ')]
		n = l[0]
		k = l[1]
		l = []
		flag = True
		if k > n:
			print('NO')
		else:
			if n % 2 == 0 and k % 2 == 0:
				c = 0
				while k > 1:
					l.append(1)
					c += 1
					k -= 1
				l.append(n - c)
				if n - c <= 0:
					flag = False
			elif n % 2 == 0 and k % 2 != 0:
				c = 0
				while k > 1:
					l.append(2)
					c += 2
					k -= 1
				l.append(n - c)
				if n - c <= 0:
					flag = False
			elif n % 2 != 0 and k % 2 == 0:
				flag = False
			else:
				c = 0
				while k > 1:
					l.append(1)
					c += 1
					k -= 1
				l.append(n - c)
				if n - c <= 0:
					flag = False
			if flag:
				print('YES')
				for i in l:
					print(i, end=' ')
				print()
			else:
				print('NO')
main()


n = int(input())
inp = []
for i in range(n):
	inp.append([])
	(n1, n2) = map(int, input().split(' '))
	inp[i].append(n1)
	inp[i].append(n2)

def preds(a, b):
	if a < b:
		return 'NO'
	if (a - b + 1) % 2 == 1:
		ret = []
		for i in range(b - 1):
			ret.append('1')
		ret.append(str(a - b + 1))
		return ret
	else:
		if a < 2 * b:
			return 'NO'
		if (a - b - (b - 1)) % 2 == 1:
			ret = []
			for i in range(b - 1):
				ret.append('2')
			ret.append(str(a - 2 * (b - 1)))
			return ret
		else:
			return 'NO'
for i in range(len(inp)):
	ans = preds(inp[i][0], inp[i][1])
	if ans == 'NO':
		print('NO')
	else:
		print('YES')
		print(' '.join(ans))


try:
	t = int(input())
	for i in range(t):
		(n, k) = map(int, input().split())
		l1 = []
		l2 = []
		x = 2 * (k - 1)
		if (n - x) % 2 == 0 and n - x >= 2:
			l1.append(n - x)
			for i in range(k - 1):
				l1.append(2)
		y = 1 * (k - 1)
		if (n - y) % 2 != 0 and n - y >= 1:
			l2.append(n - y)
			for i in range(k - 1):
				l2.append(1)
		if len(l1) > 0:
			print('YES')
			for i in l1:
				print(i, end=' ')
			print()
		elif len(l2) > 0:
			print('YES')
			for i in l2:
				print(i, end=' ')
			print()
		else:
			print('NO')
except EOFError:
	pass


class Solution:

	def even(self, n, t):
		if t < 1:
			return None
		x = (t - 1) * 2
		if (n - x) % 2 != 0:
			return None
		if n - x < 1:
			return None
		res = [2] * (t - 1) + [n - x]
		if sum(res) != n:
			return None
		return res

	def odd(self, n, t):
		if t < 1:
			return None
		x = (t - 1) * 1
		if (n - x) % 2 == 0:
			return None
		if n - x < 1:
			return None
		res = [1] * (t - 1) + [n - x]
		if sum(res) != n:
			return None
		return res
tests = int(input())
solution = Solution()
for test in range(tests):
	splits = str(input()).split(' ')
	n = int(splits[0])
	t = int(splits[1])
	even = solution.even(n, t)
	odd = solution.odd(n, t)
	if even is not None:
		print('YES')
		print(' '.join(map(str, even)))
	elif odd is not None:
		print('YES')
		print(' '.join(map(str, odd)))
	else:
		print('NO')


T = int(input())
for tc in range(T):
	(n, k) = map(int, input().split())
	if n % 2 == 1:
		if k % 2 == 0:
			print('NO')
		elif k > n:
			print('NO')
		else:
			print('YES')
			res = [1] * (k - 1) + [n - (k - 1)]
			print(*res)
	elif n // 2 >= k:
		print('YES')
		res = [2] * (k - 1) + [n - 2 * (k - 1)]
		print(*res)
	elif k % 2 == 0 and n >= k:
		print('YES')
		res = [1] * (k - 1) + [n - (k - 1)]
		print(*res)
	else:
		print('NO')


from math import trunc
from sys import exit
t = int(input())
for _ in range(t):
	(n, k) = [int(x) for x in input().split()]
	if k > n:
		print('NO')
		continue
	if n % k == 0:
		print('YES')
		for i in range(k):
			print(trunc(n / k), end=' ')
		print(end='\n')
	else:
		mod = n % k
		ai = trunc(n / k)
		ans = [ai] * k
		ans[0] += mod
		if (ai + mod) % 2 == 0 and ai % 2 == 0 or ((ai + mod) % 2 != 0 and ai % 2 != 0):
			print('YES')
			for i in ans:
				print(i, end=' ')
			print(end='\n')
		elif ai - 1 <= 0:
			print('NO')
			continue
		else:
			for i in range(1, k):
				if i % 2 != 0:
					ans[i] -= 1
				else:
					ans[i] += 1
			if sum(ans) == n:
				print('YES')
				for i in ans:
					print(i, end=' ')
				print(end='\n')
			else:
				print('NO')


INT_MAX = 10 ** 19 + 7
MOD = 10 ** 12 + 7

def INPUT():
	return list((int(i) for i in input().split()))

def LIST_1D_ARRAY(n):
	return [0 for _ in range(n)]

def LIST_2D_ARRAY(m, n):
	return [[0 for _ in range(n)] for _ in range(m)]
for _ in range(int(input())):
	(n, k) = INPUT()
	if k > n:
		print('NO')
	elif n & 1 != 0 and k % 2 == 0:
		print('NO')
	elif (n + k) % 2 == 0:
		A = [1 for i in range(k)]
		req = abs(n - k)
		A[0] += req
		print('YES')
		print(*A)
	elif n % 2 == 0 and k % 2 == 1:
		A = [2 for i in range(k)]
		if k * 2 > n:
			print('NO')
		else:
			req = abs(2 * k - n)
			A[0] += req
			print('YES')
			print(*A)


def main():
	n_t = int(input())
	for t in range(n_t):
		(n, k) = map(int, input().split(' '))
		if n < k:
			ans = 'NO'
		else:
			rem = n % k
			m = n // k
			div = [m for _ in range(k)]
			div[-1] += rem
			ans = 'YES'
			if m % 2 != div[-1] % 2:
				if (k - 1) % 2 != 0:
					ans = 'NO'
				else:
					for i in range(0, k - 1, 2):
						div[i] += 1
						div[i + 1] -= 1
					if 0 in div:
						ans = 'NO'
		print(ans)
		if ans == 'YES':
			print(' '.join([str(item) for item in div]))
main()


t = int(input())
while t:
	t -= 1
	a = list(map(int, input().strip().split()))[:2]
	x = a[0]
	y = a[1]
	if x % 2 == 1:
		if y > x or y % 2 == 0:
			print('NO')
			continue
		print('YES')
		for i in range(y - 1):
			print('1', end=' ')
		print(x - y + 1)
	elif y % 2 == 1:
		if x < 2 * y:
			print('NO')
			continue
		print('YES')
		for i in range(y - 1):
			print('2', end=' ')
		print(x - 2 * y + 2)
	else:
		if x < y:
			print('NO')
			continue
		print('YES')
		for i in range(y - 1):
			print('1', end=' ')
		print(x - y + 1)


def solve():
	(n, k) = map(int, input().split())
	f = 0
	n1 = n - k + 1
	if n1 > 0 and n1 & 1:
		print('YES')
		print('1 ' * (k - 1) + str(n - k + 1))
		f = 1
	n2 = n - 2 * (k - 1)
	if f == 0 and n2 > 0 and (n2 % 2 == 0):
		print('YES')
		print('2 ' * (k - 1) + str(n - 2 * (k - 1)))
		f = 1
	if f == 0:
		print('NO')
for _ in range(int(input())):
	solve()


import sys
input = sys.stdin.readline
T = int(input())
for ti in range(1, T + 1):
	(n, k) = map(int, input().split())
	found = False
	ak = n - k + 1
	if ak > 0 and ak % 2 == 1:
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(ak)
		found = True
	if not found:
		ak = n - 2 * (k - 1)
		if ak > 0 and ak % 2 == 0:
			print('YES')
			for i in range(k - 1):
				print(2, end=' ')
			print(ak)
			found = True
	if not found:
		print('NO')


num = int(input())

def test(n, k, res):
	last = n - res * (k - 1)
	if res > 0 and last % 2 == 0 and (res % 2 == 0) or (res > 0 and last % 2 == 1 and (res % 2 == 1)):
		print('YES')
		print(' '.join([str(res) for i in range(k - 1)]), end=' ')
		print(last)
		return
	last = n - (res - 1) * (k - 1)
	if res - 1 > 0 and last % 2 == 0 and ((res - 1) % 2 == 0) or (res - 1 > 0 and last % 2 == 1 and ((res - 1) % 2 == 1)):
		print('YES')
		print(' '.join([str(res - 1) for i in range(k - 1)]), end=' ')
		print(last)
		return
	last = n - (res - 2) * (k - 1)
	if res - 2 > 0 and last % 2 == 0 and ((res - 2) % 2 == 0) or (res - 2 > 0 and last % 2 == 1 and ((res - 2) % 2 == 1)):
		print('YES')
		print(' '.join([str(res - 2) for i in range(k - 1)]), end=' ')
		print(last)
		return
	print('NO')
for i in range(num):
	(n, k) = map(int, input().split())
	if n < k:
		print('NO')
		continue
	res = n // k
	if res * k == n:
		print('YES')
		print(' '.join([str(res) for i in range(k)]))
	else:
		test(n, k, res)


from sys import stdin, exit
input = stdin.readline

def i():
	return input()

def ii():
	return int(input())

def iis():
	return map(int, input().split())

def liis():
	return list(map(int, input().split()))

def print_array(a):
	print(' '.join(map(str, a)))
t = ii()
for _ in range(t):
	(n, k) = iis()
	if (n - 2 * (k - 1)) % 2 == 0 and n - 2 * (k - 1) > 0:
		print('YES')
		a = []
		for i in range(k - 1):
			a.append(2)
		a.append(n - sum(a))
		print_array(a)
	elif (n - 1 * (k - 1)) % 2 == 1 and n - 1 * (k - 1) > 0:
		print('YES')
		a = []
		for i in range(k - 1):
			a.append(1)
		a.append(n - sum(a))
		print_array(a)
	else:
		print('NO')


t = int(input())
while t:
	(n, k) = map(int, input().strip().split())
	if n % 2 and k % 2 == 0 or k > n:
		print('NO')
	elif n % 2 == 0:
		if k % 2:
			if n // 2 >= k:
				print('YES')
				ans = [n - k * 2 + 2] + [2] * (k - 1)
				print(' '.join(map(str, ans)))
			else:
				print('NO')
		else:
			print('YES')
			ans = [n - k + 1] + [1] * (k - 1)
			print(' '.join(map(str, ans)))
	else:
		print('YES')
		ans = [n - k + 1] + [1] * (k - 1)
		print(' '.join(map(str, ans)))
	t -= 1


for case in range(int(input())):
	(n, k) = input().split()
	(n, k) = (int(n), int(k))
	if n % 2 == 0 and k % 2 == 0 and (n >= k):
		print('Yes')
		ans = str(n - k + 1)
		for i in range(k - 1):
			ans += ' ' + '1'
		print(ans)
	elif n % 2 == 1 and k % 2 == 0:
		print('No')
	elif n + (k - 1) * (n % 2 - 2) <= 0:
		print('No')
	else:
		print('Yes')
		ans = str(n - (k - 1) * (2 - n % 2))
		for i in range(k - 1):
			ans += ' ' + str(2 - n % 2)
		print(ans)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	a = [1 for i in range(k)]
	if (n - sum(a)) % 2 == 0 and sum(a) <= n:
		a[0] += n - sum(a)
	else:
		a[0] += n
	if sum(a) > n:
		a = [2 for i in range(k)]
		if (n - sum(a)) % 2 == 0 and sum(a) <= n:
			a[0] += n - sum(a)
		else:
			a[0] += n
	if sum(a) == n:
		print('YES')
		for j in a:
			print(j, ' ', end='')
		print('')
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	n1 = n - (k - 1)
	n2 = n - 2 * (k - 1)
	res = []
	if n1 > 0 and n1 % 2 == 1:
		print('YES')
		for i in range(k - 1):
			res.append('1')
		res.append(str(n1))
		print(' '.join(res))
	elif n2 > 0 and n2 % 2 == 0:
		print('YES')
		for i in range(k - 1):
			res.append('2')
		res.append(str(n2))
		print(' '.join(res))
	else:
		print('NO')


from sys import stdin, setrecursionlimit, stdout
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin

def ii():
	return int(stdin.readline())

def fi():
	return float(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def fmi():
	return map(float, stdin.readline().split())

def li():
	return list(mi())

def lsi():
	x = list(stdin.readline())
	x.pop()
	return x

def si():
	return stdin.readline().rstrip()
res = ['YES', 'NO']
test_case = ii()
while test_case:
	test_case -= 1
	(n, k) = mi()
	f = 1
	if k <= n:
		if (n - k + 1) % 2:
			f = 0
			a = [1] * (k - 1) + [n - k + 1]
		elif (n + 2 - 2 * k) % 2 == 0 and n + 2 - 2 * k > 0:
			f = 0
			a = [2] * (k - 1) + [n + 2 - 2 * k]
	print(res[f])
	if not f:
		print(*a)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	l = list()
	if k > n:
		print('NO')
		continue
	if n % 2 == 0:
		if k % 2 == 1:
			if k * 2 > n:
				print('NO')
				continue
	elif k % 2 == 0:
		print('NO')
		continue
	print('YES')
	if n % 2 == 0:
		if k % 2 == 0:
			for j in range(k - 1):
				l.append(1)
			l.append(n - (k - 1))
		else:
			for j in range(k - 1):
				l.append(2)
			l.append(n - (k - 1) * 2)
	else:
		for j in range(k - 1):
			l.append(1)
		l.append(n - (k - 1))
	print(*l)


for q in range(int(input())):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
	elif k == n:
		print('YES')
		print('1 ' * n)
	elif k % 2 == 0:
		if n % 2 == 1:
			print('NO')
		else:
			res = []
			flag = False
			N = n
			K = k
			while n > 0 and k > 0:
				res.append(2)
				n -= 2
				k -= 1
			if n > 0:
				res.pop()
				res.append(n + 2)
				print('YES')
				print(*res)
				flag = True
			elif k == 0:
				print('YES')
				print(*res)
				flag = True
			else:
				pass
			if flag == False:
				res = []
				n = N
				k = K
				while n > 0 and k > 0:
					res.append(1)
					n -= 1
					k -= 1
				if n > 0:
					res.pop()
					res.append(n + 1)
				print('YES')
				print(*res)
	elif n % 2 == 1:
		res = []
		while n > 0 and k > 0:
			res.append(1)
			n -= 1
			k -= 1
		if n > 0:
			res.pop()
			res.append(n + 1)
		print('YES')
		print(*res)
	else:
		res = []
		while n > 0 and k > 0:
			res.append(2)
			n -= 2
			k -= 1
		if n > 0:
			res.pop()
			res.append(n + 2)
			print('YES')
			print(*res)
		elif k == 0:
			print('YES')
			print(*res)
		else:
			print('NO')


def prob(n, k):
	if n % 2 == 1:
		if k % 2 == 0:
			print('NO')
		elif n - k + 1 > 0:
			print('YES')
			for i in range(k - 1):
				print(1, end=' ')
			print(n - k + 1)
		else:
			print('NO')
	if n % 2 == 0:
		if k % 2 == 0 and n - k + 1 > 0:
			print('YES')
			for i in range(k - 1):
				print(1, end=' ')
			print(n - k + 1)
		elif k % 2 == 1 and n - 2 * (k - 1) > 0:
			print('YES')
			for i in range(k - 1):
				print(2, end=' ')
			print(n - 2 * (k - 1))
		else:
			print('NO')
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	prob(n, k)


import math
t = int(input())
while t:
	inp1 = list(map(int, input().strip().split()))[:2]
	(n, k) = (inp1[0], inp1[1])
	if k > n:
		print('NO')
	elif n % 2 == 1 and k % 2 == 0:
		print('NO')
	elif n - (k - 1) > 0 and (n - (k - 1)) % 2:
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(n - (k - 1))
	elif n - 2 * (k - 1) > 0 and (n - 2 * (k - 1)) % 2 == 0:
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		print(n - 2 * (k - 1))
	else:
		print('NO')
	t -= 1


pairs = []
for _ in range(int(input())):
	pairs.append(list(map(int, input().split())))
for (n, k) in pairs:
	if k > n:
		print('NO')
		continue
	ans = []
	if n % 2 == 1:
		if k % 2 == 0:
			print('NO')
			continue
		else:
			ans = [1] * (k - 1) + [n - k + 1]
	elif n - 2 * k + 2 > 0:
		ans = [2] * (k - 1) + [n - 2 * k + 2]
	elif k % 2 == 1:
		print('NO')
		continue
	else:
		ans = [1] * (k - 1) + [n - k + 1]
	print('YES')
	for i in ans:
		print(i, end=' ')
	print()


from collections import *
from itertools import *
from functools import *
import sys
import os
import time
timer = False
debug = False

def timeit(method):

	def wrapper(*args, **kwargs):
		mname = method.__name__
		if debug:
			print('{}(args:{}, kwargs:{})'.format(mname, args, kwargs))
		if timer:
			ts = time.time()
		result = method(*args, **kwargs)
		if timer:
			te = time.time()
			print('%r  %2.2f ms' % (mname, (te - ts) * 1000))
		return result
	return wrapper

def read_ints():
	return list(map(int, input().split()))

def read_floats():
	return list(map(float, input().split()))

def read_strs():
	return input().split()

@timeit
def main():
	t = int(input())
	for _ in range(t):
		(n, k) = read_ints()
		if n < k:
			print('NO')
			continue
		if k == n:
			print('YES')
			ans = [1] * n
			print(*ans)
			continue
		if n > k:
			if n % 2 == 0 and k % 2 == 0:
				ans = [1] * (k - 1)
				ans.append(n - k + 1)
				print('YES')
				print(*ans)
			elif n % 2 == 0 and k % 2 != 0:
				if n < 2 * k:
					print('NO')
					continue
				else:
					ans = [2] * (k - 1)
					ans.append(n - 2 * k + 2)
					print('YES')
					print(*ans)
					continue
			elif n % 2 != 0 and k % 2 == 0:
				print('NO')
				continue
			else:
				ans = [1] * (k - 1)
				ans.append(n - k + 1)
				print('YES')
				print(*ans)
main()


for _ in range(int(input())):
	X = list(map(int, input().split()))
	(Number, Check) = (1, True)
	while Number <= min(X[0] // X[1], 2):
		if (X[0] - Number * X[1]) % 2 == 0:
			print('YES')
			print((str(Number) + ' ') * (X[1] - 1) + str(Number + X[0] - Number * X[1]))
			Check = False
			break
		Number += 1
	if Check:
		print('NO')


def printer(x, b):
	for i in range(0, b):
		print(x, end=' ')
t = int(input())
for i in range(0, t):
	(a, b) = list(map(int, input().split()))
	if b > a:
		print('NO')
	elif a % b == 0:
		print('YES')
		c = int(a / b)
		printer(c, b)
		print()
	elif a % 2 == 1:
		if b % 2 == 0:
			print('NO')
		else:
			print('YES')
			e = 1
			printer(e, b - 1)
			print(a - b + 1)
	elif b % 2 == 0:
		print('YES')
		e = 1
		printer(e, b - 1)
		print(a - b + 1)
	elif a - b >= b:
		print('YES')
		e = 2
		printer(e, b - 1)
		print(int(a - 2 * (b - 1)))
	else:
		print('NO')


testCases = int(input())
while testCases > 0:
	(n, k) = map(int, input().split())
	listA = []
	yes = True
	if n == k:
		x = 0
		while x < k:
			listA.append(1)
			x += 1
	elif k == 1:
		listA.append(n)
	elif n % 2 == 0:
		x = 1
		while x < k:
			listA.append(2)
			x += 1
		listA.append(n - len(listA) * 2)
		if listA[-1] <= 0:
			listA = []
			x = 1
			while x < k:
				listA.append(1)
				x += 1
			if (n - len(listA)) % 2 == 1:
				listA.append(n - len(listA))
			else:
				yes = False
			if listA[-1] <= 0:
				yes = False
	elif n - k > 0 and (n - k) % 2 == 0:
		x = 1
		while x < k:
			listA.append(1)
			x += 1
		listA.append(n - len(listA))
	else:
		yes = False
	if yes == False:
		print('NO')
	else:
		print('YES')
		print(*listA)
	testCases -= 1


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n % 2 == 1:
		answer = [1] * (k - 1)
		if sum(answer) >= n or (n - sum(answer)) % 2 == 0:
			print('NO')
		else:
			print('YES')
			print(*answer + [n - sum(answer)])
	else:
		answer = [1] * (k - 1)
		if sum(answer) >= n or (n - sum(answer)) % 2 == 0:
			answer = [2] * (k - 1)
			if sum(answer) >= n:
				print('NO')
			else:
				print('YES')
				print(*answer + [n - sum(answer)])
		else:
			print('YES')
			print(*answer + [n - sum(answer)])


t = int(input())
for q in range(t):
	(n, k) = [int(i) for i in input().split(' ')]
	c = k - 1
	n1 = n - c
	n2 = n - 2 * c
	if n1 % 2 == 1 and n1 > 0:
		print('YES')
		print(n1, '1 ' * c)
	elif n2 % 2 == 0 and n2 > 0:
		print('YES')
		print(n2, '2 ' * c)
	else:
		print('NO')


def solve():
	(n, k) = map(int, input().split())
	temp = (k - 1) * 2
	if temp >= n or (n - (k - 1) * 2) % 2 != 0:
		dummy = 1
	else:
		print('YES')
		print((k - 1) * '2 ' + str(n - (k - 1) * 2))
		return
	temp = k - 1
	if temp >= n or (n - k + 1) % 2 != 1:
		dummy = 1
	else:
		print('YES')
		print((k - 1) * '1 ' + str(n - k + 1))
		return
	print('NO')
	return
t = 1
t = int(input())
while t > 0:
	t -= 1
	solve()


import io
import os
from collections import Counter, defaultdict, deque

def solve(N, K):
	K -= 1
	if (N - 2 * K) % 2 == 0 and N - 2 * K > 0:
		return 'YES\n' + ' '.join(map(str, [2] * K + [N - 2 * K]))
	if (N - K) % 2 == 1 and N - K > 0:
		return 'YES\n' + ' '.join(map(str, [1] * K + [N - K]))
	return 'NO'
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
T = int(input())
for t in range(T):
	(N, K) = [int(x) for x in input().split()]
	ans = solve(N, K)
	print(ans)


import sys
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = sys.stdin.readline
for tt in range(int(input())):
	(n, k) = map(int, input().split())
	if (n - 2 * (k - 1)) % 2 == 0 and n - 2 * (k - 1) > 0:
		print('YES')
		print('2 ' * (k - 1) + str(n - 2 * (k - 1)))
	elif (n - (k - 1)) % 2 == 1 and n - (k - 1) > 0:
		print('YES')
		print('1 ' * (k - 1) + str(n - (k - 1)))
	else:
		print('NO')


def solve(n, k):
	if n % k == 0:
		print('YES')
		for i in range(k):
			print('{} '.format(int(n / k)), end='')
		print('')
	elif n - k + 1 <= 0:
		print('NO')
	elif (n - k + 1) % 2 != 0:
		print('YES')
		for i in range(k - 1):
			print('{} '.format(1), end='')
		print(n - k + 1)
	elif n - 2 * k + 2 <= 0:
		print('NO')
	elif (n - 2 * k + 2) % 2 == 0:
		print('YES')
		for i in range(k - 1):
			print('{} '.format(2), end='')
		print(n - 2 * k + 2)
	else:
		print('NO')
i = int(input())
for k in range(i):
	j = input().split(' ')
	arr = list(map(int, j))
	solve(arr[0], arr[1])


import math
t = int(input())
num = [input().split() for x in range(t)]
for x in num:
	i = 0
	j = 0
	tr = 0
	n = int(x[0])
	k = int(x[1])
	if n < k:
		print('NO')
		continue
	q = math.floor(n / k)
	r = n % k
	z = [q] * k
	z[-1] = q + r
	if (q + r) % 2 == 0 and q % 2 == 0:
		tr += 1
	elif (q + r) % 2 != 0 and q % 2 != 0:
		tr += 1
	elif (k - 1) % 2 == 0:
		tr += 2
	if tr == 1:
		print('YES')
		print(*z, sep=' ')
	elif tr == 2:
		for s in range(0, len(z) - 1, 2):
			z[s] += 1
			z[s + 1] -= 1
		if z[1] == 0:
			print('NO')
			continue
		print('YES')
		print(*z, sep=' ')
	elif tr == 0:
		print('NO')


q = int(input())
while q > 0:
	q -= 1
	(a, b) = map(int, input().split())
	ok = False
	if a - 2 * (b - 1) >= 2 and (a - 2 * (b - 1)) % 2 == 0:
		print('YES')
		for i in range(1, b):
			print(2, end=' ')
		print(a - 2 * (b - 1))
	elif a - (b - 1) >= 1 and (a - (b - 1)) % 2 == 1:
		print('YES')
		for i in range(1, b):
			print(1, end=' ')
		print(a - (b - 1))
	else:
		print('NO')


import sys
from os import path
if path.exists('C:/Users/prana/Desktop/sublime/input.txt'):
	sys.stdin = open('C:/Users/prana/Desktop/sublime/input.txt', 'r')
	sys.stdout = open('C:/Users/prana/Desktop/sublime/output.txt', 'w')

def solve():
	(n, k) = input().split()
	n = int(n)
	k = int(k)
	if n % 2 != 0 and k % 2 == 0 or n < k:
		print('NO')
	elif n % 2 != 0:
		if n >= k:
			ans = [1] * (k - 1)
			ans.append(n - k + 1)
			print('YES')
			for i in ans:
				print(i, end=' ')
			print(end='\n')
		else:
			print('NO')
	elif n % 2 == 0 and k % 2 != 0 and (n // 2 < k):
		print(n, n // 2, k, 'hy', file=sys.stderr)
		print('NO')
	else:
		print('YES')
		x = n // k
		if x % 2 != 0 and x != 1:
			ans = [x - 1] * (k - 1)
			ans.append(n - (k - 1) * (x - 1))
		else:
			ans = [x] * (k - 1)
			ans.append(n - x * (k - 1))
		for i in ans:
			print(i, end=' ')
		print(end='\n')
T = 1
T = int(input())
for _ in range(1, T + 1):
	print('Case #', _, file=sys.stderr)
	solve()


z = int(input())
for _ in range(z):
	(n, k) = map(int, input().split())
	wyn = ''
	if n % 2 == 1 and k % 2 == 0 or k > n:
		print('NO')
		continue
	r1 = n - (k - 1)
	r2 = n - (k - 1) * 2
	if r1 > 0 and r1 % 2 == 1:
		for x in range(k - 1):
			wyn += '1 '
		wyn += str(r1)
		print('YES')
		print(wyn)
		continue
	if r2 > 0 and r2 % 2 == 0:
		for x in range(k - 1):
			wyn += '2 '
		wyn += str(r2)
		print('YES')
		print(wyn)
		continue
	print('NO')


MOD = 10 ** 9 + 7
RLIMIT = 1000
DEBUG = 1

def main():
	for _ in inputt():
		(n, k) = inputi()
		if n - k >= 0 and (not (n - k) % 2):
			print('YES')
			print(*[1] * (k - 1) + [n - k + 1])
		elif n - k * 2 >= 0 and (not n % 2):
			print('YES')
			print(*[2] * (k - 1) + [n - k * 2 + 2])
		else:
			print('NO')
from math import *
from heapq import *
from itertools import *
from functools import reduce, lru_cache, partial
from collections import Counter, defaultdict
import re, copy, operator, cmath
import sys, io, os, builtins
sys.setrecursionlimit(RLIMIT)
BUFSIZE = 8192

class FastIO(io.IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = io.BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(io.IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	if args:
		sys.stdout.write(str(args[0]))
		split = kwargs.pop('split', ' ')
		for arg in args[1:]:
			sys.stdout.write(split)
			sys.stdout.write(str(arg))
	sys.stdout.write(kwargs.pop('end', '\n'))

def debug(*args, **kwargs):
	if DEBUG and (not __debug__):
		print('debug', *args, **kwargs)
		sys.stdout.flush()
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip()
inputt = lambda t=0: range(t) if t else range(int(input()))
inputs = lambda : input().split()
inputi = lambda k=int: map(k, inputs())
inputl = lambda t=0, k=lambda : list(inputi()): [k() for _ in range(t)] if t else list(k())

def len(a):
	if isinstance(a, range):
		return -((a.start - a.stop) // a.step)
	return builtins.len(a)

def bisect_left(a, x, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	if key == None:
		key = do_nothing
	while lo < hi:
		mid = (lo + hi) // 2
		if key(a[mid]) < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def bisect_right(a, x, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	if key == None:
		key = do_nothing
	while lo < hi:
		mid = (lo + hi) // 2
		if x < key(a[mid]):
			hi = mid
		else:
			lo = mid + 1
	return lo

def insort_left(a, x, key=None, lo=0, hi=None):
	lo = bisect_left(a, x, key, lo, hi)
	a.insert(lo, x)

def insort_right(a, x, key=None, lo=0, hi=None):
	lo = bisect_right(a, x, key, lo, hi)
	a.insert(lo, x)
do_nothing = lambda x: x
bisect = bisect_right
insort = insort_right

def index(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	if key == None:
		key = do_nothing
	i = bisect_left(a, x, key, lo, hi)
	if lo <= i < hi and key(a[i]) == x:
		return a[i]
	if default != None:
		return default
	raise ValueError

def find_lt(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_left(a, x, key, lo, hi)
	if lo < i <= hi:
		return a[i - 1]
	if default != None:
		return default
	raise ValueError

def find_le(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_right(a, x, key, lo, hi)
	if lo < i <= hi:
		return a[i - 1]
	if default != None:
		return default
	raise ValueError

def find_gt(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_right(a, x, key, lo, hi)
	if lo <= i < hi:
		return a[i]
	if default != None:
		return default
	raise ValueError

def find_ge(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_left(a, x, key, lo, hi)
	if lo <= i < hi:
		return a[i]
	if default != None:
		return default
	raise ValueError

class Tree:

	def __init__(n):
		self._n = n
		self._conn = [[] for _ in range(n)]
		self._list = [0] * n

	def connect(a, b):
		pass

class Sieve:

	def __init__(self):
		self._n = 6
		self._list = [2, 3, 5, 7, 11, 13]

	def extend(self, n):
		if n <= self._list[-1]:
			return
		maxbase = int(n ** 0.5) + 1
		self.extend(maxbase)
		begin = self._list[-1] + 1
		newsieve = [i for i in range(begin, n + 1)]
		for p in self.primerange(2, maxbase):
			for i in range(-begin % p, len(newsieve), p):
				newsieve[i] = 0
		self._list.extend([x for x in newsieve if x])

	def extend_to_no(self, i):
		while len(self._list) < i:
			self.extend(int(self._list[-1] * 1.5))

	def primerange(self, a, b):
		a = max(2, a)
		if a >= b:
			return
		self.extend(b)
		i = self.search(a)[1]
		maxi = len(self._list) + 1
		while i < maxi:
			p = self._list[i - 1]
			if p < b:
				yield p
				i += 1
			else:
				return

	def search(self, n):
		if n < 2:
			raise ValueError
		if n > self._list[-1]:
			self.extend(n)
		b = bisect(self._list, n)
		if self._list[b - 1] == n:
			return (b, b)
		else:
			return (b, b + 1)

	def __contains__(self, n):
		if n < 2:
			raise ValueError
		if not n % 2:
			return n == 2
		(a, b) = self.search(n)
		return a == b

	def __getitem__(self, n):
		if isinstance(n, slice):
			self.extend_to_no(n.stop + 1)
			return self._list[n.start:n.stop:n.step]
		else:
			self.extend_to_no(n + 1)
			return self._list[n]
sieve = Sieve()

def isprime(n):
	if n <= sieve._list[-1]:
		return n in sieve
	for i in sieve:
		if not n % i:
			return False
		if n < i * i:
			return True
prime = sieve.__getitem__
primerange = lambda a, b=0: sieve.primerange(a, b) if b else sieve.primerange(2, a)

def factorint(n):
	factors = []
	for i in sieve:
		if n < i * i:
			break
		while not n % i:
			factors.append(i)
			n //= i
	if n != 1:
		factors.append(n)
	return factors
factordict = lambda n: Counter(factorint(n))
main()


test_cases = int(input())
for _ in range(test_cases):
	(n, k) = map(int, input().split(' '))
	odd_left = n - (k - 1)
	even_left = n - 2 * (k - 1)
	if odd_left > 0 and odd_left % 2 == 1:
		print('YES')
		print('1 ' * (k - 1), n - k + 1, sep='')
	elif even_left > 0 and even_left % 2 == 0:
		print('YES')
		print('2 ' * (k - 1), n - 2 * (k - 1), sep='')
	else:
		print('NO')


inp = lambda : map(int, input().split())
t = int(input())
for _ in range(t):
	(n, k) = inp()
	if n % 2 == 0 and n >= 2 * k:
		print('YES')
		print(*[2] * (k - 1), n - 2 * k + 2)
	elif n >= k and (n - k + 1) % 2 == 1:
		print('YES')
		print(*[1] * (k - 1), n - k + 1)
	else:
		print('NO')


from collections import deque
t = int(input())
rez = []
for i in range(t):
	p = ''
	A = input().split()
	n = int(A[0])
	k = int(A[1])
	if k == 1:
		rez.append('YES')
		rez.append(n)
	elif n % 2 != 0 and k % 2 == 0 or k == n - 1 or k > n:
		rez.append('NO')
		continue
	else:
		ost = int(n % k)
		ch = int(n // k)
		if n == k:
			for j in range(k):
				p += '1 '
		elif ost % 2 == 0:
			for j in range(k - 1):
				p += str(ch) + ' '
			p += str(ch + ost)
		elif ch == 1:
			rez.append('NO')
			continue
		else:
			ch -= 1
			for j in range(k - 1):
				p += str(ch) + ' '
			p += str(n - (k - 1) * ch)
		rez.append('YES')
		rez.append(p)
for i in range(len(rez)):
	print(rez[i])


import sys
agGK = int(input())
for _ in range(agGK):
	(n, k) = map(int, input().split())
	if (n - (k - 1)) % 2 == 1 and n - k + 1 > 0:
		print('YES')
		print('1 ' * (k - 1), end='')
		print(n - k + 1)
	elif n % 2 == 0 and n - (k - 1) * 2 > 0:
		print('YES')
		print('2 ' * (k - 1), end='')
		print(n - (k - 1) * 2)
	elif n == k:
		print('YES')
		print('1 ' * k)
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	temp = n - k + 1
	if temp > 0 and temp % 2 == 1:
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(temp)
		continue
	temp2 = n - 2 * (k - 1)
	if temp2 > 0 and temp2 % 2 == 0:
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		print(temp2)
		continue
	print('NO')


counter = int(input())
for i in range(counter):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
	elif n % 2 == 1 and k % 2 == 0:
		print('NO')
	elif n % 2 == 1 and k % 2 == 1:
		summ = 0
		print('YES')
		for i in range(k - 1):
			summ += 1
			print(1, end=' ')
		print(n - summ)
	elif n % 2 == 0 and k % 2 == 1:
		if n / k < 2:
			print('NO')
		else:
			summ = 0
			print('YES')
			for i in range(k - 1):
				summ += 2
				print(2, end=' ')
			print(n - summ)
	elif n % 2 == 0 and k % 2 == 0:
		parity = n // k
		if parity < 1:
			print('NO')
		else:
			print('YES')
			summ = 0
			for i in range(k - 1):
				summ += parity
				print(parity, end=' ')
			print(n - summ)


from sys import stdin
input = lambda : stdin.readline()
ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(map(int, input().split()))
for _ in range(ii()):
	(n, k) = mi()
	(a, b) = (1 * (k - 1), 2 * (k - 1))
	if n - a > 0 and (n - a) % 2 == 1 % 2:
		print('YES')
		print('1 ' * (k - 1) + str(n - a))
	elif n - b > 0 and (n - b) % 2 == 2 % 2:
		print('YES')
		print('2 ' * (k - 1) + str(n - b))
	else:
		print('NO')


def f(x, y):
	if y > x:
		print('NO')
		return
	elif y == x:
		a = []
		for i in range(0, y):
			a.append(1)
		print('YES')
		return a
	elif (x - y) % 2 == 0:
		a = [x - y + 1]
		for i in range(1, y):
			a.append(1)
		print('YES')
		return a
	elif y % 2 == 0:
		print('NO')
		return
	elif x < 2 * y:
		print('NO')
		return
	else:
		a = [x - 2 * y + 2]
		for i in range(1, y):
			a.append(2)
		print('YES')
		return a
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	arr = f(n, k)
	if arr:
		for i in arr:
			print(i, end=' ')
		print()


n = int(input())
for i in range(n):
	x = input().split()
	num1 = int(x[0])
	k = int(x[1])
	if num1 >= k * 2 and num1 % 2 == 0:
		print('YES')
		print(f"{' '.join((k - 1) * ['2'])} {num1 - (k - 1) * 2}")
	elif num1 >= k and (num1 - k + 1) % 2 != 0:
		print('YES')
		print(f"{' '.join((k - 1) * ['1'])} {num1 - k + 1}")
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	n1 = n - (k - 1)
	n2 = n - 2 * (k - 1)
	ls = []
	s = 0
	if n1 % 2 == 1 and n1 > 0:
		for j in range(k - 1):
			ls.append(1)
			s += ls[j]
		ls.insert(-1, n - s)
		print('YES')
		for i in ls:
			print(i, end=' ')
	elif n2 % 2 == 0 and n2 > 0:
		for j in range(k - 1):
			ls.append(2)
			s += ls[j]
		ls.insert(-1, n - s)
		print('YES')
		for i in ls:
			print(i, end=' ')
	else:
		print('NO')


T = int(input())
for t in range(T):
	(n, k) = map(int, input().split())
	s = n - (k - 1)
	if s % 2 == 1 and s >= 1:
		print('YES')
		ans = '1 ' * (k - 1) + str(s)
		print(ans)
	else:
		s = n - (k - 1) * 2
		if s % 2 == 0 and s >= 1:
			print('YES')
			ans = '2 ' * (k - 1) + str(s)
			print(ans)
		else:
			print('NO')


test = int(input())
respostas = []
for x in range(test):
	(n, k) = map(int, input().split())
	if n - k + 1 > 0 and (n - k + 1) % 2 != 0:
		respostas.append('YES')
		impares = ['1'] * (k - 1)
		impares.append(str(n - k + 1))
		respostas.append(' '.join(impares))
	elif n - 2 * (k - 1) > 0 and (n - 2 * (k - 1)) % 2 == 0:
		respostas.append('YES')
		pares = ['2'] * (k - 1)
		pares.append(str(n - 2 * (k - 1)))
		respostas.append(' '.join(pares))
	else:
		respostas.append('NO')
for x in respostas:
	print(x)


def solution():
	t = int(input())
	for _ in range(t):
		(n, k) = map(int, input().split())
		if k > n or (n % 2 == 1 and k % 2 == 0):
			print('NO')
			continue
		nums = []
		if n % 2 == 1 or n == k or k % 2 == 0:
			for i in range(k - 1):
				nums.append(1)
				n -= 1
			if n % 2 == 1:
				print('YES')
				for j in range(k - 1):
					print(nums[j], end=' ')
				print(n)
			else:
				print('NO')
		else:
			for i in range(k - 1):
				nums.append(2)
				n -= 2
			if n > 0:
				print('YES')
				for j in range(k - 1):
					print(nums[j], end=' ')
				print(n)
			else:
				print('NO')
solution()


import math
t = int(input())
while t != 0:
	(n, x) = map(int, input().strip().split())
	oddnum = n - (x - 1)
	e = 2 * (x - 1)
	evenum = n - e
	if oddnum % 2 != 0 and oddnum > 0:
		print('YES')
		for i in range(x - 1):
			print(1, end=' ')
		print(oddnum)
	elif evenum % 2 == 0 and evenum > 0:
		print('YES')
		for i in range(x - 1):
			print(2, end=' ')
		print(evenum)
	else:
		print('NO')
	t -= 1


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	if n % 2 and (not k % 2):
		print('NO')
		continue
	if not n % 2 and k % 2:
		rez = ['2'] * (k - 1) + [n - 2 * k + 2]
	else:
		rez = ['1'] * (k - 1) + [n - k + 1]
	if rez[-1] <= 0:
		print('NO')
		continue
	print('YES')
	print(*rez)


t_count = int(input().strip())
while t_count > 0:
	(n, k) = list(map(int, input().strip().split(' ')))
	if n % 2 == 0:
		if k % 2 == 0:
			if n >= 2 * k:
				rem = n - 2 * (k - 1)
				print('YES')
				print('2 ' * (k - 1), rem, sep='')
			elif n >= k:
				rem = n - k + 1
				print('YES')
				print('1 ' * (k - 1), rem, sep='')
			else:
				print('NO')
		elif n >= 2 * k:
			rem = n - 2 * (k - 1)
			print('YES')
			print('2 ' * (k - 1), rem, sep='')
		else:
			print('NO')
	elif k % 2 == 0:
		print('NO')
	elif n >= k:
		rem = n - k + 1
		print('YES')
		print('1 ' * (k - 1), rem, sep='')
	else:
		print('NO')
	t_count -= 1


a = int(input())
for i in range(a):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
		continue
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
		continue
	if n % 2 == 1 and k % 2 == 1:
		ans = []
		for i in range(k - 1):
			ans.append(1)
		ans.append(n - sum(ans))
		print('YES')
		print(*ans)
	if n % 2 == 0 and k % 2 == 1:
		if n < 2 * k:
			print('NO')
			continue
		ans = []
		for i in range(k - 1):
			ans.append(2)
		ans.append(n - sum(ans))
		print('YES')
		print(*ans)
		continue
	if n % 2 == 0 and k % 2 == 0:
		ans = []
		for i in range(k - 1):
			ans.append(1)
		ans.append(n - sum(ans))
		print('YES')
		print(*ans)


t = int(input())
for k in range(t):
	(n, k) = map(int, input().split())
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
	elif n % 2 == 0 and k % 2 == 1:
		output = [2] * (k - 1)
		x = n - (k - 1) * 2
		if x > 0:
			output.append(x)
			print('YES')
			print(*output)
		else:
			print('NO')
	else:
		output = [1] * (k - 1)
		x = n - k + 1
		if x > 0:
			output.append(x)
			print('YES')
			print(*output)
		else:
			print('NO')


a = []
t = int(input())
for _ in range(t):
	a.append(list(map(int, input().split())))
for t in range(t):
	(x, y) = a[t]
	c = y
	ans = []
	if x == y:
		for n in range(x):
			ans.append(1)
	elif x % 2 == 0:
		if x / y < 2:
			while y > 1:
				ans.append(1)
				y -= 1
			ans.append(x - sum(ans))
		else:
			while y > 1:
				ans.append(2)
				y -= 1
			ans.append(x - sum(ans))
	else:
		while y > 1:
			ans.append(1)
			y -= 1
		ans.append(x - sum(ans))
	f = True
	p = ans[0] % 2
	for x in ans:
		if x % 2 != p or x <= 0:
			f = False
	if f:
		print('YES')
		ans = list(map(str, ans))
		print(' '.join(ans))
	else:
		print('NO')


s = []
for _ in range(int(input())):
	(n, k) = [int(i) for i in input().split()]
	s2 = ''
	b = None
	if n % 2 == k % 2:
		b = 1
	else:
		b = 2
	while k != 1 and n != 0:
		s2 += str(b) + ' '
		n -= b
		k -= 1
	if k == 1 and n > 0 and (n % 2 == b % 2):
		print('YES')
		print(s2 + str(n))
	else:
		print('NO')


from math import *
from copy import *
from string import *
from random import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
import math

def bin1(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = k ** mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin1(mid + 1, r, k, t, b, val, ans)
		else:
			return bin1(l, mid - 1, k, t, b, val, ans)

def bin2(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = t * k ** mid + b * mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin2(l, mid - 1, k, t, b, val, ans)
		else:
			return bin2(mid + 1, r, k, t, b, val, ans)

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	l = []
	for i in range(2, n + 1):
		if prime[i]:
			l.append(i)
	return l

def bin(l, r, ll, val):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		if val >= ll[mid][0] and val <= ll[mid][1]:
			return mid
		elif val < ll[mid][0]:
			return bin(l, mid - 1, ll, val)
		else:
			return bin(mid + 1, r, ll, val)

def deci(n):
	s = ''
	while n != 0:
		if n % 2 == 0:
			n = n // 2
			s = '0' + s
		else:
			n = n // 2
			s = '1' + s
	return s

def diff(s1, s2):
	if len(s1) < len(s2):
		v = len(s1)
		while v != len(s2):
			s1 = '0' + s1
			v = v + 1
	else:
		v = len(s2)
		while v != len(s1):
			s2 = '0' + s2
			v = v + 1
	c = 0
	for i in range(len(s1)):
		if s1[i:i + 1] != s2[i:i + 1]:
			c = c + 1
	return c
from sys import stdin, stdout

def fac(a, b):
	v = a
	while a != b:
		v *= a - 1
		a = a - 1
	return v

def bino(l, r, n):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		val1 = math.log(n / mid + 1, 2)
		val2 = int(val1)
		if val1 == val2:
			return val1
		elif val1 < 1.0:
			return bino(l, mid - 1, n)
		else:
			return bino(mid + 1, r, n)

def binary(l, r, val, ans):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		v = val ** 5 - mid ** 5
		print(v)
		if v == ans:
			print('HOHOHOH')
			return mid
		elif v < ans:
			return binary(mid + 1, r, val, ans)
		else:
			return binary(l, mid - 1, val, ans)

def check(n):
	v = 1
	while n != 0:
		if n % 10 == 0 or n % 10 == 1:
			n = n // 10
		else:
			v = 0
			break
	return v

def stairs(n, m, val, c, l):
	if val > n:
		return 100000
	elif val == n:
		if l[val] != -1:
			return l[val]
		elif c % m == 0:
			l[val] = c
			return l[val]
		else:
			l[val] = 100000
			return l[val]
	else:
		l[val] = min(stairs(n, m, val + 1, c + 1, l), stairs(n, m, val + 2, c + 1, l))
		return l[val]

def fact(n):
	if n == 0 or n == 1:
		return 1
	else:
		return n * fact(n - 1)

def some(n):
	s = 0
	while n != 0:
		s += fact(n % 10)
		n //= 10
	return s

def bin(l, r, val, ll):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		print(ll[mid])
		if ll[mid] == val:
			return mid
		elif ll[mid] > val:
			return bin(l, mid - 1, val, ll)
		else:
			return bin(mid + 1, r, val, ll)
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split(' '))
	if k > n:
		print('NO')
	elif n % 2 != 0:
		if k % 2 == 0:
			print('NO')
		else:
			l = []
			for j in range(k - 1):
				l.append(1)
			l.append(n - (k - 1))
			print('YES')
			print(*l)
	else:
		l = []
		for j in range(k - 1):
			l.append(2)
		if n - 2 * (k - 1) > 0:
			print('YES')
			l.append(n - 2 * (k - 1))
			print(*l)
		else:
			l1 = []
			for j in range(k - 1):
				l1.append(1)
			val = n - (k - 1)
			if val > 0 and val % 2 != 0:
				l1.append(val)
				print('YES')
				print(*l1)
			else:
				print('NO')


def main():
	(n, k) = map(int, input().split())
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
		return
	elif n % 2 == 0:
		if k % 2 == 1:
			if n < 2 * k:
				print('NO')
				return
			else:
				print('YES')
				line = '2 ' * (k - 1) + str(n - 2 * (k - 1))
				print(line)
		if k % 2 == 0:
			if n < k:
				print('NO')
				return
			else:
				print('YES')
				line = '1 ' * (k - 1) + str(n - k + 1)
				print(line)
	elif k % 2 == 0:
		print('NO')
		return
	elif n < k:
		print('NO')
		return
	else:
		print('YES')
		line = '1 ' * (k - 1) + str(n - k + 1)
		print(line)
t = int(input())
for i in range(t):
	main()


import sys
input = sys.stdin.readline
t = int(input())
for tests in range(t):
	(n, k) = map(int, input().split())
	if n % 2 == k % 2 and n >= k:
		print('YES')
		ANS = [1] * (k - 1) + [n - (k - 1)]
		print(*ANS)
	elif n % 2 == 0 and n >= 2 * k:
		print('YES')
		ANS = [2] * (k - 1) + [n - 2 * (k - 1)]
		print(*ANS)
	else:
		print('NO')


n = int(input())
nums = []
for i in range(n):
	in_num = input().split()
	nums.append([int(in_num[0]), int(in_num[1])])
for num in nums:
	test1 = num[0] - (num[1] - 1)
	test2 = num[0] - 2 * (num[1] - 1)
	if test1 % 2 == 1 and test1 > 0:
		print('YES')
		print(test1, end=' ')
		while num[0] > test1:
			print(1, end=' ')
			num[0] -= 1
		print()
	elif test2 % 2 == 0 and test2 > 0:
		print('YES')
		print(test2, end=' ')
		while num[0] > test2:
			print(2, end=' ')
			num[0] -= 2
		print()
	else:
		print('NO')


def solve(n, m):
	arr = [1] * (m - 1)
	temp = n - 2 * (m - 1)
	if temp > 0 and temp % 2 == 0:
		print('YES')
		aux = [2] * (m - 1)
		aux.append(temp)
		print(*aux, sep=' ')
		return
	temp = n - (m - 1)
	if temp > 0 and temp % 2 == 1:
		print('YES')
		aux = [1] * (m - 1)
		aux.append(temp)
		print(*aux, sep=' ')
		return
	print('NO')
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	solve(n, k)


import math
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	e = 2
	o = 1
	e = e * (k - 1)
	o = o * (k - 1)
	if (n - e) % 2 == 0 and n > e:
		print('YES')
		for j in range(k - 1):
			print('2', end=' ')
		print(n - e)
		continue
	if (n - o) % 2 != 0 and n > o:
		print('YES')
		for j in range(k - 1):
			print('1', end=' ')
		print(n - o)
		continue
	print('NO')


def solve():
	(n, k) = [int(i) for i in input().split()]
	arr = []
	suma = 0
	for i in range(k - 1):
		arr.append(1)
		suma += 1
	if n - suma > 0 and (n - suma) % 2:
		arr.append(n - suma)
		print('YES')
		for i in arr:
			print(i, end=' ')
		print()
		return
	arr = []
	suma = 0
	for i in range(k - 1):
		arr.append(2)
		suma += 2
	if n - suma > 0 and (n - suma) % 2 == 0:
		arr.append(n - suma)
		print('YES')
		for i in arr:
			print(i, end=' ')
		print()
		return
	print('NO')
t = int(input())
for i in range(t):
	solve()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if k == 1:
		print('YES')
		print(n)
		continue
	if k > n or k == n - 1 or (n % 2 != 0 and k % 2 == 0):
		print('NO')
		continue
	if n % k == 0:
		l = []
		print('YES')
		for i in range(k):
			l.append(n // k)
		print(*l)
	else:
		num = n - (k - 1)
		if num % 2 != 0:
			l = []
			print('YES')
			for i in range(k - 1):
				l.append(1)
			l.append(num)
			print(*l)
		else:
			num = n - 2 * (k - 1)
			if num > 0 and num % 2 == 0:
				l = []
				print('YES')
				for i in range(k - 1):
					l.append(2)
				l.append(num)
				print(*l)
			else:
				print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n - k + 1 > 0 and n - k + 1 & 1:
		print('Yes\n' + (k - 1) * '1 ' + str(n - k + 1))
	elif n - 2 * k + 2 > 0 and (not n - 2 * k + 2 & 1):
		print('Yes\n' + (k - 1) * '2 ' + str(n - 2 * k + 2))
	else:
		print('NO')


import sys
import math
from collections import defaultdict

def solve(test):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
	elif n & 1:
		if k & 1:
			res = []
			for i in range(k - 1):
				res.append('1')
			res.append(str(n - (k - 1)))
			print('YES')
			print(' '.join(res))
		else:
			print('NO')
	elif k & 1:
		if k > n // 2:
			print('NO')
		else:
			res = []
			for i in range(k - 1):
				res.append('2')
			res.append(str(n - 2 * (k - 1)))
			print('YES')
			print(' '.join(res))
	else:
		res = []
		for i in range(k - 1):
			res.append('1')
		res.append(str(n - (k - 1)))
		print('YES')
		print(' '.join(res))
test_cases = int(input())
for t in range(1, test_cases + 1):
	solve(t)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	rem1 = n - (k - 1)
	if rem1 > 0 and rem1 % 2 == 1:
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(rem1)
		continue
	rem2 = n - 2 * (k - 1)
	if rem2 > 0 and rem2 % 2 == 0:
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		print(rem2)
		continue
	print('NO')


x = 1
x += 1
x += 7
for standth in range(1):
	for tests in range(int(input())):
		(n, k) = map(int, input().split())
		if k > n:
			print('NO')
		elif n % 2 == 1 and k % 2 == 0:
			print('NO')
		elif n % 2 == 0 and k % 2 == 1 and (k > n // 2):
			print('NO')
		elif n % 2 == k % 2:
			print('YES')
			print('1 ' * (k - 1) + str(n - k + 1))
		else:
			print('YES')
			print('2 ' * (k - 1) + str(n - (k - 1) * 2))


import sys
t = int(input())
for _ in range(t):
	(n, k) = [int(x) for x in input().split()]
	if k % 2 == 0 and (n % 2 == 1 or k > n) or (k % 2 == 1 and (n % 2 == 1 and k > n or (n % 2 == 0 and 2 * k > n))):
		print('NO')
	else:
		print('YES')
		if n % 2 == 0:
			if k % 2 == 0:
				for _ in range(k - 1):
					print(1, end=' ')
				print(n - (k - 1))
			else:
				for _ in range(k - 1):
					print(2, end=' ')
				print(n - 2 * (k - 1))
		else:
			for _ in range(k - 1):
				print(1, end=' ')
			print(n - (k - 1))


t = int(input())
for R in range(t):
	(n, k) = map(int, input().split())
	flag = 0
	if n % 2 != 0 and k % 2 == 0:
		print('NO')
	elif n % 2 == 0:
		List = []
		req = n - (k - 1) * 2
		if req > 0 and req % 2 == 0:
			List = [2 for x in range(k - 1)]
			List.insert(0, req)
		elif k % 2 == 0:
			req = n - (k - 1)
			if req > 0 and req % 2 != 0:
				List = [1 for x in range(k - 1)]
				List.insert(0, req)
		if len(List):
			print('YES')
			print(*List)
		else:
			print('NO')
	else:
		List = []
		req = n - (k - 1)
		if req > 0 and req % 2 != 0:
			List = [1 for x in range(k - 1)]
			List.insert(0, req)
		if len(List):
			print('YES')
			print(*List)
		else:
			print('NO')


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	c = a % 2
	d = b % 2
	if c == 1 and d == 0 or a < b or (c == 0 and d == 1 and (a < 2 * b)):
		print('NO')
	else:
		print('YES')
		if d == 0 or (c == 1 and d == 1):
			ans = a - b + 1
			for i in range(b - 1):
				print(1, end=' ')
			print(ans)
		else:
			ans = a - 2 * b + 2
			for i in range(b - 1):
				print(2, end=' ')
			print(ans)


def tosum(n, k):
	if k > n:
		return ('No', [])
	if n % 2 != 0:
		if k % 2 == 0:
			return ('No', [])
		else:
			ans = [1] * (k - 1)
			ans.append(n - (k - 1))
			return ('Yes', ans)
	elif k % 2 == 0:
		ans = [1] * (k - 1)
		ans.append(n - (k - 1))
		return ('Yes', ans)
	elif 2 * k > n:
		return ('No', [])
	else:
		ans = [2] * (k - 1)
		ans.append(n - 2 * (k - 1))
		return ('Yes', ans)
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	(yes_no, answer) = tosum(n, k)
	print(yes_no)
	if len(answer) != 0:
		print(*answer)


from math import floor
t = int(input())
for tt in range(t):
	(n, k) = list(map(int, input().split()))
	a = []
	e1 = n - 2 * (k - 1)
	e2 = n - k - 1
	if n % k == 0:
		print('YES')
		for i in range(k):
			print(n // k, end=' ')
	elif e1 % 2 == 0 and e1 > 0:
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		print(n - 2 * (k - 1))
	elif e2 % 2 == 1 and e2 > 0:
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(n - k + 1)
	else:
		print('NO')


def solution(t):
	for i in range(t):
		nk = input().split()
		(n, k) = (int(nk[0]), int(nk[1]))
		if n < k:
			print('no')
		elif n % 2 and k % 2 == 0:
			print('no')
		elif n == k:
			print('YES')
			print('1 ' * k)
		elif n % k == 0:
			print('YES')
			print((str(n // k) + ' ') * k)
		elif n % 2 == 0 and k % 2:
			if n < k * 2:
				print('no')
			else:
				print('YES')
				print('2 ' * (k - 1) + str(n - 2 * (k - 1)))
		else:
			print('YES')
			print('1 ' * (k - 1) + str(n - (k - 1)))
solution(int(input()))


import sys
t = int(input())
for _ in range(t):
	arr = input().split(' ')
	n = int(arr[0])
	k = int(arr[1])
	digit = 1 if (n - k + 1) % 2 == 1 else 2
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
	elif n < k * digit:
		print('NO')
	else:
		print('YES')
		result = [digit] * (k - 1)
		result.append(n - (k - 1) * digit)
		print(' '.join((str(i) for i in result)))


for f in range(int(input())):
	(n, k) = map(int, input().split())
	if k % 2 == 0:
		if n % 2 == 0:
			if n < k:
				print('NO')
			else:
				print('YES')
				sol = [1] * k
				sol[0] = n - k + 1
				print(*sol)
		else:
			print('NO')
	elif n % 2 == 0:
		if 2 * k > n:
			print('NO')
		else:
			print('YES')
			sol = [2] * k
			sol[0] = n - 2 * k + 2
			print(*sol)
	elif k > n:
		print('NO')
	else:
		print('YES')
		sol = [1] * k
		sol[0] = n - k + 1
		print(*sol)


def funx(n, k):
	if n < k:
		print('NO')
		return 0
	else:
		f = []
		if n % 2 == 0:
			if n < 2 * k:
				if k % 2 == 1:
					print('NO')
					return 0
				else:
					for i in range(k - 1):
						f.append(1)
					f.append(n - k + 1)
					print('YES')
					print(*f)
					return 0
			else:
				for i in range(k - 1):
					f.append(2)
				f.append(n - 2 * (k - 1))
				print('YES')
				print(*f)
				return 0
		elif k % 2 == 0:
			print('NO')
			return 0
		else:
			for i in range(k - 1):
				f.append(1)
			f.append(n - k + 1)
			print('YES')
			print(*f)
			return 0
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n == k:
		f = []
		for i in range(k):
			f.append(1)
		print('YES')
		print(*f)
	else:
		funx(n, k)


import sys
from bisect import *
from math import floor, sqrt, ceil, factorial as F, gcd, pi
from itertools import chain, combinations, permutations, accumulate
from collections import Counter, defaultdict, OrderedDict, deque
from array import array
INT_MAX = sys.maxsize
INT_MIN = -sys.maxsize - 1
mod = 1000000007
ch = 'abcdefghijklmnopqrstuvwxyz'
lcm = lambda a, b: a * b // gcd(a, b)
setbit = lambda x: bin(x)[2:].count('1')
Int = lambda type: type(sys.stdin.readline()) if type in [int, float] else type(sys.stdin.readline()).replace('\n', '')
Array = lambda type: list(map(type, sys.stdin.readline().split()))
Nums = lambda type: map(type, sys.stdin.readline().split())

def solve():
	T = Int(int)
	for _ in range(T):
		(n, k) = Nums(int)
		if n % k == 0:
			print('YES')
			print(*[n // k] * k)
		elif n < k:
			print('NO')
		elif n - k + 1 & 1 and n - k + 1 > 0:
			print('YES')
			print(*[1] * (k - 1) + [n - k + 1])
		elif not n - 2 * (k - 1) & 1 and n - 2 * (k - 1) > 0:
			print('YES')
			print(*[2] * (k - 1) + [n - 2 * (k - 1)])
		else:
			print('NO')
try:
	sys.stdin = open('input.txt', 'r')
except:
	pass
solve()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	n1 = n - (k - 1)
	done = False
	if n1 % 2 == 1 and n1 > 0:
		print('YES')
		for _ in range(k - 1):
			print('1', end=' ')
		print(n1)
		done = True
	if not done:
		n2 = n - 2 * (k - 1)
		if n2 % 2 == 0 and n2 > 0:
			print('YES')
			for _ in range(k - 1):
				print('2', end=' ')
			print(n2)
			done = True
	if not done:
		print('NO')


from sys import stdin
a = int(stdin.readline())
for b in range(0, a):
	c = stdin.readline().split()
	n = int(c[0])
	k = int(c[1])
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
	if n % 2 == 0 and k % 2 == 0:
		if n < k:
			print('NO')
		else:
			print('YES')
			for g in range(0, k - 1):
				print('1', end=' ')
			print(n - k + 1)
	if n % 2 == 0 and k % 2 == 1:
		if 2 * k > n:
			print('NO')
		else:
			print('YES')
			for g in range(0, k - 1):
				print('2', end=' ')
			print(n - 2 * k + 2)
	if n % 2 == 1 and k % 2 == 1:
		if n < k:
			print('NO')
		else:
			print('YES')
			for g in range(0, k - 1):
				print('1', end=' ')
			print(n - k + 1)


def main():
	t = int(input())
	for i in range(t):
		(n, k) = map(int, input().split())
		if n < k:
			print('NO')
			continue
		if n % 2 == 0:
			if k % 2 == 0:
				ans_list = [1] * (k - 1)
				ans_list.append(n - k + 1)
				print('YES')
				print(*ans_list)
			elif 2 * k <= n:
				ans_list = [2] * (k - 1)
				ans_list.append(n - 2 * (k - 1))
				print('YES')
				print(*ans_list)
			else:
				print('NO')
				continue
		elif k % 2 == 1:
			ans_list = [1] * (k - 1)
			ans_list.append(n - k + 1)
			print('YES')
			print(*ans_list)
		else:
			print('NO')
			continue
main()


def readInt():
	return int(input())

def readList():
	return list(map(int, input().rstrip().split()))

def readString():
	s = input()
	return s

def readInts():
	return map(int, input().rstrip().split())

def solve(n, k):
	rest = n - (k - 1)
	if rest > 0 and rest % 2 == 1:
		print('YES')
		r = []
		for i in range(k - 1):
			r.append(1)
		r.append(rest)
		print(' '.join([str(e) for e in r]))
		return
	rest_2 = n - (k - 1) * 2
	if rest_2 > 0 and rest_2 % 2 == 0:
		print('YES')
		r = []
		for i in range(k - 1):
			r.append(2)
		r.append(rest_2)
		print(' '.join([str(e) for e in r]))
		return
	print('NO')
t = readInt()
for i in range(t):
	(n, k) = readInts()
	solve(n, k)


for _ in range(int(input())):
	(N, K) = map(int, input().split())
	if N >= K:
		if N % 2:
			if K % 2:
				print('YES')
				print('1 ' * (K - 1) + str(N - K + 1))
			else:
				print('NO')
		elif N >= 2 * K:
			print('YES')
			print('2 ' * (K - 1) + str(N - 2 * (K - 1)))
		elif K % 2 == 0:
			print('YES')
			print('1 ' * (K - 1) + str(N - K + 1))
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	n1 = n2 = n
	res1 = []
	res2 = []
	for _ in range(k - 1):
		res1.append(1)
		n1 -= 1
		res2.append(2)
		n2 -= 2
	if n1 % 2 == 1 and n1 > 0:
		print('YES')
		print(*res1, n1)
	elif n2 % 2 == 0 and n2 > 0:
		print('YES')
		print(*res2, n2)
	else:
		print('NO')


def solve(n, k):
	if (n - k + 1) % 2 == 1:
		print('YES\n' + str(n - k + 1), '1 ' * (k - 1), sep=' ')
	elif k % 2 == 1 and n / k >= 2:
		print('YES\n' + str(n - 2 * (k - 1)), '2 ' * (k - 1))
	else:
		print('NO')
for j in range(int(input())):
	(n, k) = map(int, input().split())
	solve(n, k) if k <= n else print('NO')


for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	l = []
	if k % 2 == 0 and n % 2 == 1:
		print('NO')
		continue
	elif k % 2 == 1 and n % 2 == 1 or (k % 2 == 0 and n % 2 == 0):
		a = 1
		b = n - k + 1
	else:
		a = 2
		b = n - 2 * (k - 1)
	l = [b] + [a] * (k - 1)
	if b > 0:
		print('YES')
		print(' '.join((str(i) for i in l)))
	else:
		print('NO')


from sys import stdin, stdout
from itertools import combinations
from collections import defaultdict, Counter
import math

def listIn():
	return list(map(int, stdin.readline().strip().split()))

def stringListIn():
	return [x for x in stdin.readline().split()]

def intIn():
	return int(stdin.readline())

def stringIn():
	return stdin.readline().strip()
t = int(input())
while t > 0:
	t -= 1
	(n, k) = listIn()
	if k > n:
		print('NO')
	elif n % k == 0:
		d = n // k
		li = [d] * k
		print('YES')
		print(*li)
	else:
		rem = n % k
		d = n // k
		if rem % 2 == 0:
			print('YES')
			li = [d] * (k - 1) + [d + rem]
			print(*li)
		elif (rem + k) % 2 == 0:
			if d - 1 == 0:
				print('NO')
			else:
				li = [d - 1] * (k - 1) + [d + rem + k - 1]
				print('YES')
				print(*li)
		else:
			print('NO')


import math, sys
from sys import stdin, stdout
from collections import Counter, defaultdict, deque
input = stdin.readline
I = lambda : int(input())
li = lambda : list(map(int, input().split()))

def case():
	(n, k) = li()
	if k > n:
		print('NO')
		return ()
	if (n - k - 1) % 2:
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(n + 1 - k)
		return
	if n - 2 * k < 0:
		print('NO')
		return
	elif (n - 2 * k - 2) % 2 == 0:
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		print(n - 2 * k + 2)
	else:
		print('NO')
for _ in range(int(input())):
	case()


def solve():
	(n, k) = map(int, input().split())
	for z in range(2):
		d = 2 - z
		ans = n - d * (k - 1)
		if ans % 2 != d % 2 or ans < 1:
			continue
		else:
			print('YES')
			for j in range(k):
				if j == 0:
					print(ans, end=' ')
				else:
					print(d, end=' ')
			print()
			return
	print('NO')
numcases = int(input())
for i in range(numcases):
	solve()


t = int(input())
ans = []
for i in range(t):
	(n, k) = map(int, input().split())
	if k > n or (k % 2 == 0 and n % 2 != 0):
		ans.append(['NO'])
	elif (n - k + 1) % 2 == 1:
		q = str(n - k + 1)
		q = '1 ' * (k - 1) + q
		ans.append(['YES', q])
	elif (n - (k - 1) * 2) % 2 == 0 and n - (k - 1) * 2 > 0:
		q = str(n - (k - 1) * 2)
		q = '2 ' * (k - 1) + q
		ans.append(['YES', q])
	else:
		ans.append(['NO'])
for i in ans:
	for j in i:
		print(''.join(map(str, j)))


from collections import Counter
import math
mod = 10 ** 9 + 7
for i in range(int(input())):
	(n, k) = map(int, input().split())
	ans = []
	flag = 0
	if n % k == 0:
		if n < k:
			print('NO')
		else:
			x = n // k
			l = n // x
			for i in range(l):
				ans.append(x)
			print('YES')
			print(*ans)
	elif (n - (k - 1)) % 2 != 0 and n - (k - 1) > 0:
		for i in range(k - 1):
			ans.append(1)
		ans.append(n - (k - 1))
		print('YES')
		print(*ans)
	elif (n - (k - 1) * 2) % 2 == 0 and n - (k - 1) * 2 > 0:
		for i in range(k - 1):
			ans.append(2)
		ans.append(n - (k - 1) * 2)
		print('YES')
		print(*ans)
	else:
		print('NO')


for i in range(int(input())):
	(n, k) = map(int, input().split())
	if n % 2 != 0 and k % 2 == 0:
		print('No')
	elif k > n:
		print('No')
	elif n % 2 != 0 and k % 2 != 0:
		print('Yes')
		for j in range(k - 1):
			print(1, end=' ')
		print(n - k + 1)
	elif n % 2 == 0 and k % 2 == 0:
		if n < k * 2:
			if n != k * 1:
				if (n - (k - 1)) % 2 == 1:
					print('Yes')
					for j in range(k - 1):
						print(1, end=' ')
					print(n - k + 1)
				else:
					print('No')
			else:
				print('Yes')
				for j in range(k):
					print(1, end=' ')
				print('\n')
		else:
			print('Yes')
			for j in range(k - 1):
				print(2, end=' ')
			print(n - (k - 1) * 2)
	elif n % 2 == 0 and k % 2 != 0:
		if n < k * 2:
			print('No')
		else:
			print('Yes')
			for j in range(k - 1):
				print(2, end=' ')
			print(n - (k - 1) * 2)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a % 2 == 0:
		if b % 2 == 0:
			if b <= a:
				print('YES')
				print('1 ' * (b - 1) + str(a - b + 1))
			else:
				print('NO')
		elif 2 * b <= a:
			print('YES')
			print('2 ' * (b - 1) + str(a - 2 * (b - 1)))
		else:
			print('NO')
	elif b % 2 == 0:
		print('NO')
	elif a - b + 1 >= 1:
		print('YES')
		print('1 ' * (b - 1) + str(a - b + 1))
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if k > n:
		print('No')
	elif n % 2 != 0 and k % 2 == 0:
		print('No')
	elif n % 2 == 0 and k % 2 == 0:
		if n / k == n // k:
			a = [n // k] * k
		else:
			a = [n // k] * (k - 1)
			a.append(int(n - n // k * (k - 1)))
		print('Yes')
		print(*a)
	elif n % 2 == 0 and n // k == 1:
		print('No')
	else:
		if n / k == n // k:
			a = [n // k] * k
		elif n % 2 == n // k % 2:
			a = [n // k] * (k - 1)
			a.append(int(n - n // k * (k - 1)))
		else:
			a = [n // k - 1] * (k - 1)
			a.append(int(n - (n // k - 1) * (k - 1)))
		print('Yes')
		print(*a)


def main(n, k):
	if k > n:
		return 'NO'
	if n % 2 and k % 2 == 0:
		return 'NO'
	if not n % 2 and k % 2:
		if 2 * k > n:
			return 'NO'
		res = '2 ' * (k - 1)
		res += str(n - 2 * (k - 1))
		print('YES')
		return res
	if n % 2 and k % 2 or (not n % 2 and (not k % 2)):
		res = '1 ' * (k - 1)
		res += str(n - (k - 1))
		print('YES')
		return res
for _ in range(int(input())):
	(n, k) = [int(x) for x in input().split()]
	print(main(n, k))


TEST = int(input())
answers = []
for _ in range(TEST):
	(n, k) = [int(x) for x in input().split()]
	if n % 2 == 1 and k % 2 == 0 or k > n:
		answers.append('NO')
	elif n == k:
		answers.append('YES\n' + '1 ' * k)
	elif n % 2 == 1 and k % 2 == 1 or (n % 2 == 0 and k % 2 == 0):
		answers.append('YES\n' + '1 ' * (k - 1) + str(n - k + 1))
	elif n >= k * 2:
		answers.append('YES\n' + '2 ' * (k - 1) + str(n - 2 * (k - 1)))
	else:
		answers.append('NO')
for ans in answers:
	print(ans)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	even_p = n % 2 == 0
	if not even_p and k % 2 == 0:
		print('NO')
		continue
	if k > n:
		print('NO')
		continue
	r = []
	if even_p and 2 * k > n:
		if k % 2 == 1:
			print('NO')
			continue
		else:
			r = [n - (k - 1)] + [1] * (k - 1)
	elif not even_p:
		r = [n - (k - 1)] + [1] * (k - 1)
	else:
		r = [n - 2 * k + 2] + [2] * (k - 1)
	print('YES')
	print(' '.join(map(str, r)))


import sys
input = sys.stdin.readline
import random
import copy
import math

def main():
	q = int(input())
	for _ in range(q):
		(n, k) = map(int, input().split())
		k -= 1
		su = 2 * k
		if (n - su) % 2 == 0 and n - su > 0:
			print('YES')
			print(n - su, end=' ')
			for x in range(k):
				print(2, end=' ')
			print()
		else:
			su = k
			if (n - su) % 2 == 1 and n - su > 0:
				print('YES')
				print(n - su, end=' ')
				for x in range(k):
					print(1, end=' ')
				print()
			else:
				print('NO')
main()


from sys import stdin
input = stdin.readline
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	if n % k == 0:
		a = n // k
		print('YES')
		[print(a, end=' ') for _ in range(k)]
		print()
	elif n < k:
		print('NO')
	else:
		a = n // k
		b = n - a * (k - 1)
		if a % 2 + b % 2 == 0 or a % 2 + b % 2 == 2:
			print('YES')
			[print(a, end=' ') for _ in range(k - 1)]
			print(b)
		elif (k - 1) % 2 == 0 and a > 1:
			print('YES')
			[print(a + i, end=' ') for i in (1, -1) for _ in range((k - 1) // 2)]
			print(b)
		else:
			print('NO')


for l in range(int(input())):
	(n, k) = map(int, input().split())
	s = []
	m = []
	n1 = 0
	f = n - (k - 1)
	g = n - (k - 1) * 2
	if n < k:
		print('NO')
	else:
		for i in range(k - 1):
			s.append(1)
			m.append(2)
		if f % 2 == 1 and f > 0 and (f % 2 == 1):
			print('YES')
			print(*s, f)
		elif f % 2 == 0 and g > 0 and (g % 2 == 0):
			print('YES')
			print(*m, g)
		else:
			print('NO')


def test_1(n, k):
	rem = n - (k - 1) * 1
	if rem > 0:
		return ['1'] * (k - 1) + [str(rem)]
	else:
		return -1

def test_2(n, k):
	rem = n - (k - 1) * 2
	if rem > 0:
		return ['2'] * (k - 1) + [str(rem)]
	else:
		return -1

def is_even(x):
	return x % 2 == 0

def is_odd(x):
	return x % 2 != 0
t = int(input())
for tt in range(t):
	nk = input().split()
	n = int(nk[0])
	k = int(nk[1])
	if is_even(n) and is_even(k):
		tmp = test_1(n, k)
	elif is_even(n) and is_odd(k):
		tmp = test_2(n, k)
	elif is_odd(n) and is_odd(k):
		tmp = test_1(n, k)
	else:
		tmp = -1
	if tmp == -1:
		print('NO')
	else:
		print('YES')
		print(' '.join(tmp))


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve():
	(n, k) = sep()
	if k % 2 == 0 and n % 2 == 1:
		print('NO')
		return
	if k > n:
		print('NO')
		return
	if k % 2 == 0 or (k % 2 == 1 and n % 2 == 1):
		print('YES')
		ans = [1] * (k - 1)
		ans.append(n - (k - 1))
		print(*ans)
	elif 2 * k > n:
		print('NO')
	else:
		print('YES')
		ans = [2] * (k - 1)
		ans.append(n - 2 * (k - 1))
		print(*ans)
testcase(int(inp()))


def rs():
	return input().strip()

def ri():
	return int(input())

def ria():
	return list(map(int, input().split()))

def ia_to_s(a):
	return ' '.join([str(s) for s in a])

def solve(n, k):
	if n < k:
		return []
	if n == k:
		return [1] * k
	if n % 2 == 0:
		if n >= 2 * k:
			return [2] * (k - 1) + [n - 2 * (k - 1)]
		elif k % 2 == 0:
			return [1] * (k - 1) + [n - k + 1]
		else:
			return []
	elif k % 2 == 0:
		return []
	else:
		return [1] * (k - 1) + [n - k + 1]

def main():
	for _ in range(ri()):
		(n, k) = ria()
		a = solve(n, k)
		if len(a) > 0:
			print('YES')
			print(ia_to_s(a))
		else:
			print('NO')
main()


T = int(input())
while T:
	T = T - 1
	(n, k) = input().split()
	N = int(n)
	K = int(k)
	if N % 2 == 0 and K % 2 == 0:
		if N >= 2 * K:
			print('YES')
			for i in range(K - 1):
				print(2, end=' ')
			print(N - 2 * (K - 1))
			continue
		elif N >= K:
			print('YES')
			for i in range(K - 1):
				print(1, end=' ')
			print(N - (K - 1))
			continue
		else:
			print('NO')
	elif N % 2 == 0 and K % 2 == 1:
		if N >= 2 * K:
			print('YES')
			for i in range(K - 1):
				print(2, end=' ')
			print(N - 2 * (K - 1))
			continue
		else:
			print('NO')
			continue
	elif N % 2 == 1 and K % 2 == 0:
		print('NO')
		continue
	elif N >= K:
		print('YES')
		for i in range(K - 1):
			print(1, end=' ')
		print(N - (K - 1))
		continue
	else:
		print('NO')
		continue


def answer(n, k):
	if k > n:
		print('NO')
		return
	if k == n:
		print('YES')
		lst = ['1' for i in range(k)]
		print(' '.join(lst))
		return
	if k == 1:
		print('YES')
		print(n)
		return
	if k % 2 == 0 and n % 2 == 0:
		print('YES')
		lst = ['1' for i in range(k - 1)]
		lst.append(str(n - (k - 1)))
		print(' '.join(lst))
		return
	if k % 2 == 0 and n % 2 == 1:
		print('NO')
		return
	if n % 2 == 0 and n >= 2 * k:
		print('YES')
		lst = ['2' for i in range(k - 1)]
		lst.append(str(n - (k - 1) * 2))
		print(' '.join(lst))
		return
	if n % 2 == 1:
		print('YES')
		lst = ['1' for i in range(k - 1)]
		lst.append(str(n - (k - 1)))
		print(' '.join(lst))
		return
	print('NO')
	return

def main():
	t = int(input())
	n = [0] * t
	k = [0] * t
	for j in range(t):
		(n[j], k[j]) = [int(i) for i in input().split()]
	for j in range(t):
		answer(n[j], k[j])
main()


def solve():
	t = int(input())
	for i in range(t):
		(target, k) = list(map(int, input().split(' ')))
		if target % k == 0:
			print('YES')
			print(*[target // k for j in range(k)])
			continue
		even_left = target - k * 2
		if even_left % 2 == 0 and even_left >= 0:
			print('YES')
			print(*[2 for m in range(k - 1)], end=' ')
			print(2 + even_left)
			continue
		odd_left = target - k
		if odd_left % 2 == 0 and odd_left >= 0:
			print('YES')
			print(*[1 for m in range(k - 1)], end=' ')
			print(1 + odd_left)
			continue
		print('NO')
solve()


def split(n, k, buckets):
	base = n // k
	if base == 0:
		return False
	if n % k == 0:
		for i in range(k):
			buckets[i] += base
		return True
	if n % k % 2 == 0:
		buckets[-1] += n % k
		for i in range(k):
			buckets[i] += base
		return True
	elif k % 2 == 1:
		base -= 1
		if base == 0:
			return False
		for i in range(k):
			buckets[i] += base
		buckets[-1] = base + k + n % k
		return True
	return False
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	buckets = [0 for _ in range(k)]
	if split(n, k, buckets):
		print('YES')
		print(' '.join(map(str, buckets)))
	else:
		print('NO')


import sys
input = lambda : sys.stdin.readline().rstrip()
inp = sys.stdin.buffer.readline

def I():
	return list(map(int, inp().split()))
for _ in range(I()[0]):
	(n, k) = I()
	ans1 = [1] * k
	ans2 = [2] * k
	if n < k:
		print('NO')
	elif n - sum(ans1) + 1 & 1 and n - sum(ans1) >= 0:
		print('YES')
		print(*ans1[1:], n - sum(ans1) + 1)
	elif n - sum(ans2) & 1 == 0 and n - sum(ans2) >= 0:
		print('YES')
		print(*ans2[1:], n - sum(ans2) + 2)
	else:
		print('NO')


t = int(input())
for t in range(0, t):
	(n, k) = [int(x) for x in input().split()]
	a = k - 1
	b = 2 * (k - 1)
	x = n - a
	y = n - b
	if x > 0 and x % 2 != 0:
		print('YES')
		z = []
		for i in range(0, k - 1):
			z.append(1)
		z.append(x)
		print(*z)
	elif y > 0 and y % 2 == 0:
		print('YES')
		z = []
		for i in range(0, k - 1):
			z.append(2)
		z.append(y)
		print(*z)
	else:
		print('NO')


def pr(m, k, a):
	print('YES')
	print(m, end=' ')
	for i in range(k - 1):
		print(a, end=' ')
	print()

def f(n, k):
	m = n - (k - 1)
	if m > 0 and m % 2 == 1:
		pr(m, k, 1)
		return
	m = n - 2 * (k - 1)
	if m > 0 and m % 2 == 0:
		pr(m, k, 2)
		return
	print('NO')
N = int(input())
for z in range(N):
	ss = input().split()
	(n, k) = [int(s) for s in ss]
	f(n, k)


q = int(input())
for i in range(q):
	(n, k) = [int(i) for i in input().split()]
	if k == 1:
		print('YES')
		print(n)
	elif n % 2 == 1 and k % 2 == 0 or k > n or k + 1 == n or ((n % 2 == 0 and k % 2 == 1) and n < k * 2):
		print('NO')
	elif n % 2 == 0 and k % 2 == 0:
		print('YES')
		print('1 ' * (k - 1) + str(n - k + 1))
	elif n % 2 == 1 and k % 2 == 1:
		print('YES')
		print('1 ' * (k - 1) + str(n - k + 1))
	elif n % 2 == 0 and k % 2 == 1:
		print('YES')
		print('2 ' * (k - 1) + str(n - (k - 1) * 2))


for t in range(int(input())):
	(n, k) = list(map(int, input().split()))
	if k > n:
		print('NO')
		continue
	if k == n:
		print('YES')
		print('1 ' * n)
		continue
	if n % k == 0:
		print('YES')
		print((str(n // k) + ' ') * k)
		continue
	aa = n // k
	a = aa * (k - 1)
	b = n - a
	if aa % 2 == 0 and b % 2 == 0 and (b > 0) and (aa > 0):
		print('YES')
		print((str(aa) + ' ') * (k - 1) + str(b))
		continue
	if aa % 2 == 1 and b % 2 == 1 and (b > 0) and (aa > 0):
		print('YES')
		print((str(aa) + ' ') * (k - 1) + str(b))
		continue
	else:
		aa = n // k + 1
		a = aa * (k - 1)
		b = n - a
		if aa % 2 == 0 and b % 2 == 0 and (b > 0) and (aa > 0):
			print('YES')
			print((str(aa) + ' ') * (k - 1), b)
			continue
		if aa % 2 == 1 and b % 2 == 1 and (b > 0) and (aa > 0):
			print('YES')
			print((str(aa) + ' ') * (k - 1), b)
			continue
		aa = n // k - 1
		a = aa * (k - 1)
		b = n - a
		if aa % 2 == 0 and b % 2 == 0 and (b > 0) and (aa > 0):
			print('YES')
			print((str(aa) + ' ') * (k - 1), b)
			continue
		if aa % 2 == 1 and b % 2 == 1 and (b > 0) and (aa > 0):
			print('YES')
			print((str(aa) + ' ') * (k - 1), b)
			continue
	print('NO')


t = int(input())
for _ in range(t):
	fail = False
	(n, k) = tuple(map(int, input().split()))
	if k == 1:
		print('YES')
		print(n)
		continue
	is_n_odd = n % 2
	is_k_odd = k % 2
	if not is_n_odd:
		if is_k_odd:
			if 2 * (k - 1) <= n - 2:
				first = '2'
				to_print = (n - 2) // (k - 1)
				if to_print % 2 == 1:
					to_print -= 1
				last = n - 2
			else:
				fail = True
		elif k - 1 <= n - 1:
			first = '1'
			to_print = (n - 1) // (k - 1)
			if to_print % 2 == 0:
				to_print -= 1
			last = n - 1
		else:
			fail = True
	elif is_k_odd:
		if k - 1 <= n - 1:
			first = '1'
			to_print = (n - 1) // (k - 1)
			if to_print % 2 == 0:
				to_print -= 1
			last = n - 1
		else:
			fail = True
	else:
		fail = True
	if not fail:
		to_print = str(to_print)
		print('YES')
		print(first, end=' ')
		for __ in range(k - 2):
			print(to_print, end=' ')
		last -= int(to_print) * (k - 2)
		print(last)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	n1 = n - k + 1
	if n1 > 0 and n1 % 2 == 1:
		print('yes')
		for i in range(0, k - 1):
			print('1', end=' ')
		print(n1)
		continue
	n2 = n - 2 * (k - 1)
	if n2 > 0 and n2 % 2 == 0:
		print('yes')
		for i in range(k - 1):
			print('2', end=' ')
		print(n2)
		continue
	else:
		print('no')


t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	if n < k:
		print('NO')
		continue
	if n % 2 == k % 2:
		print('YES')
		print(*[1] * (k - 1) + [n - k + 1])
	elif n % 2 == 1:
		print('NO')
	else:
		arr = [2] * (k - 1) + [n - k - k + 2]
		if n - 2 * k + 2 <= 0:
			print('NO')
		else:
			print('YES')
			print(*arr)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	z = 0
	q = 0
	if True:
		e = []
		for i in range(k - 1):
			e.append(2)
		x = n - sum(e)
		if x % 2 == 0 and x > 0:
			e.append(x)
			print('YES')
			print(*e)
			z = 1
	if z == 0:
		o = []
		for i in range(k - 1):
			o.append(1)
		y = n - sum(o)
		if y % 2 != 0 and y > 0:
			o.append(y)
			print('YES')
			print(*o)
			z = 1
	if z == 0:
		print('NO')


def f(n, k):
	if k > n:
		print('NO')
	elif n % 2 == 1 and k % 2 == 0:
		print('NO')
	elif n % 2 == 0 and k % 2 == 1:
		if n < 2 * k:
			print('NO')
		else:
			print('YES')
			for i in range(k - 1):
				print(2, end=' ')
			print(n - 2 * k + 2)
	else:
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(n - k + 1)
for i in range(int(input())):
	[n, k] = input().split(' ')
	f(int(n), int(k))


T = int(input())
for _ in range(T):
	(N, K) = map(int, input().split())
	if N < K:
		print('NO')
		continue
	if N < 2 * K:
		if N % 2 != K % 2:
			print('NO')
			continue
		else:
			print('YES')
			ans = [1] * K
			ans[-1] = N - K + 1
			print(*ans)
			continue
	if K % 2 == 0:
		if N % 2:
			print('NO')
		else:
			print('YES')
			ans = [1] * K
			ans[-1] = N - K + 1
			print(*ans)
	else:
		print('YES')
		if N % 2:
			ans = [1] * K
			ans[-1] = N - K + 1
			print(*ans)
		else:
			ans = [2] * K
			ans[-1] = N - 2 * K + 2
			print(*ans)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	ans = []
	if n % 2 != 0 and m % 2 == 0:
		flag = 0
	elif n % 2 != 0 and m % 2 != 0:
		if m > n:
			flag = 0
		else:
			for i in range(m - 1):
				ans.append(1)
			ans.append(n - (m - 1))
			flag = 1
	elif n % 2 == 0 and m % 2 != 0:
		if m > n // 2:
			flag = 0
		else:
			for i in range(m - 1):
				ans.append(2)
			ans.append(n - (m - 1) * 2)
			flag = 1
	elif m > n:
		flag = 0
	else:
		for i in range(m - 1):
			ans.append(1)
		ans.append(n - (m - 1))
		flag = 1
	if flag == 0:
		print('No')
	else:
		print('Yes')
		for i in ans:
			print(i, end=' ')


import sys
input = sys.stdin.readline
from bisect import bisect_left, bisect_right
INF = 1 << 60
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	if n % 2 == 0:
		if k % 2 == 1:
			if 2 * k > n:
				print('NO')
			else:
				print('YES')
				for j in range(k - 1):
					print(2, end=' ')
				print(n - 2 * k + 2)
		elif k > n:
			print('NO')
		else:
			print('YES')
			for j in range(k - 1):
				print(1, end=' ')
			print(n - k + 1)
	elif k % 2 == 0:
		print('NO')
	elif k > n:
		print('NO')
	else:
		print('YES')
		for j in range(k - 1):
			print(1, end=' ')
		print(n - k + 1)


def task(n, k):
	if k > n:
		print('NO')
		return
	if (n - k - 1) % 2 == 1:
		print('YES')
		result = [1] * (k - 1)
		result.append(n - k + 1)
		print(' '.join(map(str, result)))
		return
	if n % 2 == 0 and n >= k * 2:
		print('YES')
		result = [2] * (k - 1)
		result.append(n - 2 * (k - 1))
		print(' '.join(map(str, result)))
		return
	print('NO')
t = int(input())
for i in range(0, t):
	(n, k) = map(int, input().split())
	task(n, k)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	x = [0] * k
	c = 0
	if n % 2 == k % 2:
		for i in range(k - 1):
			x[i] = 1
			c += x[i]
		if (n - c) % 2 == 1 and n - c > 0:
			x[-1] = n - c
			print('YES')
			print(*x)
		else:
			print('NO')
	else:
		for i in range(k - 1):
			x[i] = 2
			c += x[i]
		if (n - c) % 2 == 0 and n - c > 0:
			x[-1] = n - c
			print('YES')
			print(*x)
		else:
			print('NO')


import heapq as hp
import collections
import bisect
import math
import re

def unpack(func=int):
	return map(func, input().split())

def l_unpack(func=int):
	return list(map(func, input().split()))

def s_unpack(func=int):
	return sorted(map(func, input().split()))

def ml_unpack(n):
	return [int(input()) for i in range(n)]

def range_n():
	return range(int(input()))

def counter(a):
	d = {}
	for x in a:
		if x in d:
			d[x] += 1
		else:
			d[x] = 1
	return d

def getint():
	return int(input())

def setbits(x):
	count = 0
	while x:
		x = x & x - 1
		count += 1
	return count

def main():
	for _ in range_n():
		(n, k) = unpack()
		n1 = n - k + 1
		if n1 > 0 and n1 & 1:
			print('YES')
			for i in range(k - 1):
				print(1, end=' ')
			print(n1)
			continue
		n2 = n - 2 * (k - 1)
		if n2 > 0 and n2 % 2 == 0:
			print('YES')
			for i in range(k - 1):
				print(2, end=' ')
			print(n2)
			continue
		print('NO')
main()


t = int(input())

def oddcheck(num: int, k: int) -> bool:
	lo = num - (k - 1) * 1
	if lo <= 0:
		return False
	elif lo % 2 == 1 and lo > 0:
		return True
	else:
		return False

def evencheck(num: int, k: int) -> bool:
	lo = num - (k - 1) * 2
	if lo <= 0:
		return False
	elif lo % 2 == 1:
		return False
	else:
		return True
for q in range(t):
	(n, k) = tuple(map(int, input().split()))
	cond1 = oddcheck(n, k)
	cond2 = evencheck(n, k)
	if cond1:
		print('YES')
		tgt = [1] * (k - 1)
		tgt.append(n - (k - 1))
		res = ''
		for i in tgt:
			res = res + str(i) + ' '
		print(res)
	elif cond2:
		print('YES')
		tgt = [2] * (k - 1)
		tgt.append(n - (k - 1) * 2)
		res = ''
		for i in tgt:
			res = res + str(i) + ' '
		print(res)
	elif cond1 and cond2:
		print('YES')
		tgt = [1] * (k - 1)
		tgt.append(n - (k - 1))
		res = ''
		for i in tgt:
			res = res + str(i) + ' '
		print(res)
	else:
		print('NO')


def print_list(arr):
	print('YES')
	for i in range(len(arr)):
		print(arr[i], end=' ')
	print()
t = int(input())
for i in range(t):
	(n, k) = input().split()
	n = int(n)
	k = int(k)
	values0 = [n // k for i in range(k)]
	values1 = [n // k - 1 for i in range(k)]
	if sum(values0) == n:
		print_list(values0)
	elif sum(values0) > 0:
		while sum(values0) < n:
			values0[0] += 2
		if sum(values0) == n:
			print_list(values0)
		elif n // k - 1 > 0:
			while sum(values1) < n:
				values1[0] += 2
			if sum(values1) == n:
				print_list(values1)
			else:
				print('NO')
		else:
			print('NO')
	else:
		print('NO')


from sys import stdin
import collections

def solve(tc):
	(n, k) = map(int, stdin.readline().split())
	if n < k:
		print('NO')
		return
	if n % 2:
		if k % 2 == 0:
			print('NO')
			return
		else:
			ans = [1 for i in range(k - 1)]
			ans.append(n - k + 1)
	elif k % 2:
		if n < k * 2:
			print('NO')
			return
		ans = [2 for i in range(k - 1)]
		ans.append(n - 2 * k + 2)
	else:
		ans = [1 for i in range(k - 1)]
		ans.append(n - k + 1)
	print('YES')
	for i in ans:
		print(i, end=' ')
	print()
LOCAL_TEST = not __debug__
if LOCAL_TEST:
	infile = __file__.split('.')[0] + '-test.in'
	stdin = open(infile, 'r')
tcs = int(stdin.readline().strip())
tc = 1
while tc <= tcs:
	solve(tc)
	tc += 1


a = []
for i in range(int(input())):
	(n, k) = map(int, input().split())
	nodd = int(n - (k - 1))
	noeven = int(n - 2 * (k - 1))
	if nodd > 0 and nodd % 2 == 1:
		print('YES')
		for i in range(k - 1):
			a.append(1)
		a.append(nodd)
		for elm in a:
			print(elm, end=' ')
		a = []
	elif noeven > 0 and noeven % 2 == 0:
		print('YES')
		for i in range(k - 1):
			a.append(2)
		a.append(noeven)
		for elm in a:
			print(elm, end=' ')
		a = []
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	lst = []
	r = n % k
	if n < k:
		print('NO')
	elif r == 0:
		print('YES')
		for i in range(k):
			if i == k - 1:
				print(int(n / k))
			else:
				print(int(n / k), end=' ')
	elif r % 2 == 0:
		print('YES')
		for i in range(k):
			if r != 0:
				if i == k - 1:
					print(int(n // k) + 2)
					r -= 2
				else:
					print(int(n // k) + 2, end=' ')
					r -= 2
			elif i == k - 1:
				print(int(n // k))
			else:
				print(int(n // k), end=' ')
	elif r % 2 == 1:
		if (k - 1) % 2 == 0 and n // k > 1:
			print('YES')
			lmt = (r - 1) / 2
			for i in range(k):
				if i < lmt:
					lst.append(int(n // k) + 2)
				else:
					lst.append(int(n // k))
			for i in range(k):
				if i % 2 == 0:
					if i == k - 1:
						print(lst[i] + 1)
					else:
						print(lst[i] + 1, end=' ')
				elif i == k - 1:
					print(lst[i] - 1)
				else:
					print(lst[i] - 1, end=' ')
		else:
			print('NO')


import sys
input = sys.stdin.readline
import bisect
t = int(input())
while t:
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
	elif n % 2 and (not k % 2):
		print('NO')
	else:
		lol = 0
		if n % 2 == 0:
			if 2 * k <= n:
				res = [2] * (k - 1)
				res.append(n - 2 * (k - 1))
			elif k % 2 == 0:
				res = [1] * (k - 1)
				res.append(n - k + 1)
			else:
				lol = 1
		else:
			res = [1] * (k - 1)
			res.append(n - k + 1)
		if lol:
			print('NO')
		else:
			print('YES')
			print(*res)
	t -= 1


t = int(input())
for test in range(t):
	(n, k) = map(int, input().split())
	anseven = [2] * (k - 1)
	lasteven = n - 2 * k + 2
	anseven.append(lasteven)
	ansodd = [1] * (k - 1)
	lastodd = n - k + 1
	ansodd.append(lastodd)
	if lasteven > 0 and lasteven % 2 == 0:
		print('YES')
		for item in anseven:
			print(item, end=' ')
		print()
	elif lastodd > 0 and lastodd % 2 == 1:
		print('YES')
		for item in ansodd:
			print(item, end=' ')
		print()
	else:
		print('NO')


for i in range(int(input())):
	(n, k) = map(int, input().split())
	if n - k - 1 > 0 and (n - k - 1) % 2 != 0:
		s = '1' * (k - 1)
		s = s.replace('', ' ').strip()
		print('YES')
		print(s + ' ' + str(int(n - k + 1)))
	elif n - 2 * (k - 1) > 0 and (n - 2 * (k - 1)) % 2 == 0:
		s = '2' * (k - 1)
		s = s.replace('', ' ').strip()
		print('YES')
		print(s + ' ' + str(int(n - 2 * (k - 1))))
	elif n == k:
		s = '1' * k
		s = s.replace('', ' ').strip()
		print('YES')
		print(s)
	else:
		print('NO')


T = int(input())

def even(x):
	return x % 2 == 0
while T > 0:
	(N, K) = map(int, input().split())
	ans = []
	a = N - (K - 1)
	b = N - 2 * (K - 1)
	if not even(a) and a > 0:
		print('YES')
		print(*[str(a)] + ['1'] * (K - 1))
	elif even(b) and b > 0:
		print('YES')
		print(*[str(b)] + ['2'] * (K - 1))
	else:
		print('NO')
	T -= 1


def printr(a):
	print(str(a)[1:-1].replace(',', ''))
ts = int(input())
for _ in range(ts):
	(n, k) = tuple([int(x) for x in input().split(' ')])
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
		continue
	if n - k + 1 > 0 and (n - k + 1) % 2 == 1:
		print('YES')
		printr([n - k + 1] + [1] * (k - 1))
		continue
	if n - 2 * (k - 1) > 0 and (n - 2 * (k - 1)) % 2 == 0:
		print('YES')
		printr([n - 2 * (k - 1)] + [2] * (k - 1))
		continue
	print('NO')


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return list(map(int, input().split()))

def solve(arr):
	res = []
	for a in arr:
		if a[0] % 2 != 0 and a[1] % 2 == 0:
			res.append([])
			continue
		if a[1] > a[0]:
			res.append([])
			continue
		if a[1] % 2 != 0:
			n = a[0]
			if n % 2 != 0:
				r = [1] * (a[1] - 1)
				r.append(n - sum(r))
				res.append(r)
			else:
				r = [2] * (a[1] - 1)
				if sum(r) >= n:
					res.append([])
				else:
					r.append(n - sum(r))
					res.append(r)
		else:
			n = a[0]
			r1 = [1] * (a[1] - 1)
			r2 = [2] * (a[1] - 1)
			if sum(r1) < n:
				r1.append(n - sum(r1))
				res.append(r1)
			elif sum(r2) < n:
				r2.append(n - sum(r2))
				res.append(r2)
			else:
				res.append([])
	return res
n = inp()
arr = []
for i in range(n):
	arr.append(inlt())
res = solve(arr)
for r in res:
	if r:
		print('YES')
		print(' '.join(map(str, r)))
	else:
		print('NO')


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	count = 0
	n1 = a - (b - 1)
	n2 = a - 2 * (b - 1)
	if n1 > 0 and n1 % 2 == 1:
		print('YES')
		for i in range(b - 1):
			print(1, end=' ')
		print(n1)
	elif n2 > 0 and n2 % 2 == 0:
		print('YES')
		for i in range(b - 1):
			print(2, end=' ')
		print(n2)
	else:
		print('NO')


def is1(n, k):
	if (n - k) % 2 == 0 and n - k + 1 > 0:
		print('yes')
		print((k - 1) * '1 ' + str(n - k + 1))
		return True
	return False

def is2(n, k):
	if (n - (k - 1) * 2) % 2 == 0 and n - (k - 1) * 2 > 0:
		print('yes')
		print((k - 1) * '2 ' + str(n - (k - 1) * 2))
		return True
	return False
num = int(input())
for _ in range(num):
	(n, k) = map(int, input().split())
	if not is1(n, k) and (not is2(n, k)):
		print('no')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	flag = 0
	if n % 2 and k % 2 == 0:
		print('NO')
		continue
	if n - k + 1 > 0 and (n - k + 1) % 2:
		print('YES')
		ans = [n - k + 1] + [1] * (k - 1)
		flag = 1
	elif n - 2 * (k - 1) > 0 and (n - 2 * (k - 1)) % 2 == 0:
		print('YES')
		ans = [n - 2 * (k - 1)] + [2] * (k - 1)
		flag = 1
	if flag:
		print(*ans, sep=' ')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	c = n - (k - 1)
	c1 = n - (k - 1) * 2
	if c % 2 == 1:
		if c <= 0:
			print('NO')
			continue
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(n - (k - 1))
	elif c1 % 2 == 0:
		if c1 <= 0:
			print('NO')
			continue
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		print(n - (k - 1) * 2)
	else:
		print('NO')


import math

def facts(n):
	ans = []
	for i in range(2, int(math.sqrt(n) + 1)):
		if n % i == 0:
			ans.append(i)
			ans.append(n // i)
	ans = sorted(ans)
	return ans
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n == k:
		print('YES')
		print('1 ' * k)
	elif n % 2 == 0:
		if (n - 2 * (k - 1)) % 2 == 0 and n - 2 * (k - 1) > 0:
			ans = ['2' for i in range(k - 1)]
			ans.append(str(n - 2 * (k - 1)))
			print('YES')
			print(' '.join(ans))
		elif (n - k + 1) % 2 == 1 and n - k + 1 > 0:
			ans = ['1' for i in range(k - 1)]
			ans.append(str(n - k + 1))
			print('YES')
			print(' '.join(ans))
		else:
			print('NO')
	elif (n - k + 1) % 2 == 1 and n - k + 1 > 0:
		ans = ['1' for i in range(k - 1)]
		ans.append(str(n - k + 1))
		print('YES')
		print(' '.join(ans))
	else:
		print('NO')


def parityexpansion(n, k):
	if n % 2 != 0 and k % 2 == 0:
		return (False, [])
	if k > n:
		return (False, [])
	else:
		out = []
		if n % 2 == 0:
			if k > n / 2:
				if k % 2 != 0:
					return (False, [])
				else:
					for i in range(k - 1):
						out.append(1)
						n -= 1
					if n != 0:
						out.append(n)
			else:
				if k % 2 != 0:
					out.append(2)
					k -= 1
					n -= 2
				for i in range(k - 1):
					out.append(2)
					n -= 2
				if n != 0:
					out.append(n)
		elif n % 2 != 0:
			for i in range(k - 1):
				out.append(1)
				n -= 1
			if n != 0:
				out.append(n)
	return (True, out)
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	(flag, out) = parityexpansion(n, k)
	if k == 1:
		print('YES')
		print(n)
		continue
	if flag:
		print('YES')
		print(*out)
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	r = n % k
	a = n
	if k > n:
		print('NO')
	elif n % k == 0:
		print('YES')
		for i in range(k):
			print(a // k, end=' ')
		print()
	else:
		c = 0
		while n >= k:
			if n % 2 != 0 and k % 2 == 0:
				break
			n -= k
			if n % 2 == 0:
				print('YES')
				c = 1
				break
		if c == 0:
			print('NO')
		elif c == 1:
			for i in range(k - 1):
				print((a - n) // k, end=' ')
			print((a - n) // k + n)


def repeat(r):
	print('YES')
	print(r * (k - 1), end='')
	print(n - int(r) * (k - 1))

def process(n, k):
	if k > n:
		print('NO')
	elif n % 2 == 1:
		if k % 2 == 0:
			print('NO')
		else:
			repeat('1 ')
	elif 2 * k <= n:
		repeat('2 ')
	elif k % 2 == 1:
		print('NO')
	else:
		repeat('1 ')
t = int(input())
for i in range(t):
	(nraw, kraw) = input().split()
	n = int(nraw)
	k = int(kraw)
	process(n, k)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	k1 = k - 1
	if k > n:
		print('NO')
		continue
	if (n - k1) % 2 == 1:
		ans = [1] * k1
		ans.append(n - k1)
		print('YES')
		print(*ans)
		continue
	if n - 2 * k1 >= 0 and (n - 2 * k1) % 2 == 0:
		ans = [2] * k1
		ans.append(n - 2 * k1)
		if n - 2 * k1 == 0:
			print('NO')
			continue
		print('YES')
		print(*ans)
		continue
	print('NO')


for i in range(int(input())):
	(n, k) = list(map(int, input().split()))
	nums = []
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
	elif n % 2 == 1:
		if n < k:
			print('NO')
		else:
			for j in range(k):
				if j == k - 1:
					nums.append(n)
				else:
					nums.append(1)
					n -= 1
			print('YES')
			print(' '.join((str(num) for num in nums)))
	elif n % 2 == 0 and k % 2 == 1:
		if n < 2 * k:
			print('NO')
		else:
			for j in range(k):
				if j == k - 1:
					nums.append(n)
				else:
					nums.append(2)
					n -= 2
			print('YES')
			print(' '.join((str(num) for num in nums)))
	elif n < k:
		print('NO')
	else:
		for j in range(k):
			if j == k - 1:
				nums.append(n)
			else:
				nums.append(1)
				n -= 1
		print('YES')
		print(' '.join((str(num) for num in nums)))


def solve(n, k):
	if n < k:
		return 'NO'
	ones = k - 1
	twos = (k - 1) * 2
	res = []
	if (n - k + 1) % 2 == 1 and n - k + 1 > 0:
		for i in range(k - 1):
			res.append(1)
		res.append(n - k + 1)
		return res
	elif n - twos > 0 and (n - twos) % 2 == 0:
		for i in range(k - 1):
			res.append(2)
		res.append(n - twos)
		return res
	return 'NO'

def main():
	t = int(input())
	for i in range(t):
		d = input()
		d = [int(i) for i in d.split(' ')]
		n = d[0]
		a = d[1]
		ans = solve(n, a)
		if ans == 'NO':
			print(ans)
		else:
			print('YES')
			for i in ans:
				print(i, end=' ')
			print()
main()


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	ans = []
	ans2 = []
	for i in range(k - 1):
		ans.append(2)
		ans2.append(1)
	yep = False
	yep2 = False
	if n - 2 * (k - 1) > 0:
		ans.append(n - 2 * (k - 1))
	if n - (k - 1) > 0:
		ans2.append(n - (k - 1))
	if yep and yep2:
		print('NO')
	z = ans[0] % 2
	z2 = ans2[0] % 2
	if len([x for x in ans if x % 2 == z]) == len(ans) and sum(ans) == n and (len(ans) == k):
		print('YES')
		print(*ans)
	elif len([y for y in ans2 if y % 2 == z2]) == len(ans2) and sum(ans2) == n and (len(ans2) == k):
		print('YES')
		print(*ans2)
	else:
		print('NO')


def solve(n, k):
	pre = k - 1
	ans = None
	if n - pre > 0 and (n - pre) % 2:
		ans = [1] * (k - 1) + [n - pre]
		return ['YES', list(map(str, ans))]
	pre = (k - 1) * 2
	if n - pre > 0 and (not (n - pre) % 2):
		ans = [2] * (k - 1) + [n - pre]
		return ['YES', list(map(str, ans))]
	if not ans:
		return ['NO', None]
t = int(input())
for i in range(t):
	(n, k) = list(map(int, input().split()))
	(can, ans) = solve(n, k)
	if can == 'YES':
		print('YES')
		print(' '.join(ans))
	else:
		print('NO')


I = lambda : list(map(int, input().split()))
t = I()[0]
while t:
	t -= 1
	(n, k) = I()
	if k > n:
		print('NO')
		continue
	a = n - k + 1
	if a % 2:
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
		print(a)
		continue
	else:
		a = n - (k - 1) * 2
		if a % 2 == 0 and a > 0:
			print('YES')
			for i in range(k - 1):
				print(2, end=' ')
			print(a)
			continue
	print('NO')


t = int(input())
while t:
	t -= 1
	(n, k) = list(map(int, input().split()))
	if n % 2 == 1:
		if k % 2 == 1:
			if n < k:
				print('NO')
			else:
				print('YES')
				sum = 0
				while k - 1:
					k -= 1
					sum += 1
					print(1, end=' ')
				print(n - sum)
		else:
			print('NO')
	elif k % 2 == 1:
		if n < 2 * k:
			print('NO')
		else:
			print('YES')
			sum = 0
			while k - 1:
				k -= 1
				sum += 2
				print(2, end=' ')
			print(n - sum)
	elif n < k:
		print('NO')
	else:
		print('YES')
		sum = 0
		while k - 1:
			k -= 1
			sum += 1
			print(1, end=' ')
		print(n - sum)


from sys import stdin

def PR(x):
	print(x, end='')

def run(n, k):
	if n > k - 1 and (n - k - 1) % 2 == 1:
		print('YES')
		PR('1 ' * (k - 1))
		print(str(n - k + 1))
		return
	if n > 2 * (k - 1) and (n - 2 * k + 2) % 2 == 0:
		print('YES')
		PR('2 ' * (k - 1))
		print(str(n - 2 * k + 2))
		return
	print('NO')

def main():
	t = int(stdin.readline())
	for _ in range(t):
		(n, k) = [int(x) for x in stdin.readline().split()]
		run(n, k)
main()


TC = int(input())
for i in range(TC):
	(n, k) = map(int, input().split())
	if n < k:
		print('NO')
		continue
	ans_list = []
	if (n - 2 * (k - 1)) % 2 == 0 and n - (k - 1) * 2 > 0:
		ans_list.append(n - (k - 1) * 2)
		for elem in range(k - 1):
			ans_list.append(2)
	elif (n - (k - 1)) % 2 != 0 and n - (k - 1) > 0:
		ans_list.append(n - (k - 1))
		for elem in range(k - 1):
			ans_list.append(1)
	else:
		print('NO')
		continue
	print('YES')
	for x in ans_list:
		print(x, end=' ')
	print()


import random
import math
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
		continue
	if n == k:
		print('YES')
		print('1 ' * k)
		continue
	if n % k == 0:
		print('YES')
		print((str(n // k) + ' ') * k)
		continue
	if n % 2 == 0:
		if k > n / 2:
			if k % 2 == 1:
				print('NO')
				continue
			print('YES')
			for i in range(k - 1):
				print(1, end=' ')
				n -= 1
			print(n)
			continue
		else:
			print('YES')
			for i in range(k - 1):
				print(2, end=' ')
				n -= 2
			print(n)
			continue
	if k % 2 == 1 and n % 2 == 1:
		print('YES')
		for i in range(k - 1):
			print(1, end=' ')
			n -= 1
		print(n)
	if k % 2 == 0 and n % 2 == 1:
		print('NO')


from statistics import median
from fractions import gcd
from itertools import combinations
from collections import deque
from collections import defaultdict
import bisect
import sys
sys.setrecursionlimit(10000000)
mod = 10 ** 9 + 7

def readInts():
	return list(map(int, input().split()))

def main():
	n = int(input())
	for i in range(n):
		(num, cy) = readInts()
		if (num - (cy - 1)) % 2 == 1 and num - (cy - 1) > 0:
			print('YES')
			print(*[1] * (cy - 1), num - (cy - 1))
			continue
		elif (num - (cy - 1) * 2) % 2 == 0 and num - (cy - 1) * 2 > 0:
			print('YES')
			print(*[2] * (cy - 1), num - (cy - 1) * 2)
			continue
		else:
			print('NO')
main()


for _ in range(int(input())):
	(total, arr_size) = map(int, input().split())
	odd_last = total - arr_size + 1
	even_last = total - 2 * (arr_size - 1)
	if odd_last > 0 and odd_last % 2 != 0:
		print('YES')
		print(' '.join(['1'] * (arr_size - 1)) + ' ' + str(odd_last))
	elif even_last > 0 and even_last % 2 == 0:
		print('YES')
		print(' '.join(['2'] * (arr_size - 1)) + ' ' + str(even_last))
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	nexus = n
	answer = []
	flag = 0
	for j in range(k - 1):
		if nexus <= 0:
			print('NO')
			flag = 1
			break
		else:
			nexus -= 1
			answer.append(1)
	if flag == 1:
		continue
	if nexus > 0 and nexus % 2 == 1:
		answer.append(nexus)
		print('YES')
		print(*answer)
		continue
	nexus = n
	answer = []
	flag = 0
	for j in range(k - 1):
		if nexus <= 0:
			print('NO')
			flag = 1
			break
		else:
			nexus -= 2
			answer.append(2)
	if flag == 1:
		continue
	if nexus > 0 and nexus % 2 == 0:
		answer.append(nexus)
		print('YES')
		print(*answer)
		continue
	print('NO')


t = int(input())
for q in range(t):
	(n, k) = [int(a) for a in input().split()]
	done = 0
	for small in range(1, 3):
		last = n - small * (k - 1)
		if last > 0 and last % 2 == small % 2:
			print('YES')
			for i in range(k - 1):
				print(small, end=' ')
			print(last)
			done = 1
			break
	if done:
		continue
	print('NO')


import math

def r():
	return map(int, input().split())

def l():
	return list(map(int, input().split()))

def i():
	return int(input())

def si():
	return input()

def pYes():
	print('YES')

def pNo():
	print('NO')

def plist(l):
	print(''.join(l))
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	a = False
	res = []
	if n % 2 == 1:
		if k % 2 == 0:
			a = True
		elif k > n:
			a = True
		else:
			for i in range(k - 1):
				res.append(1)
			res.append(n - k + 1)
		if a:
			print('NO')
		else:
			print('YES')
			print(*res)
	else:
		if k > n and k % 2 == 0 or (2 * k > n and k % 2 == 1):
			a = True
		elif k % 2 == 0 and n >= k:
			for i in range(k - 1):
				res.append(1)
			res.append(n - k + 1)
		else:
			for i in range(k - 1):
				res.append(2)
			res.append(n - 2 * (k - 1))
		if a:
			print('NO')
		else:
			print('YES')
			print(*res)


T = int(input())
n = [0] * T
k = [0] * T
for t in range(T):
	(n[t], k[t]) = [int(i) for i in input().split(' ')]

def ans(n, k):
	if n % 2 == 1 and k % 2 == 0:
		return 'NO'
	elif k > n:
		return 'NO'
	elif n % 2 == 0 and k % 2 == 1 and (2 * k > n):
		return 'NO'
	elif n % 2 == 0 and k % 2 == 1:
		return [str(2)] * (k - 1) + [str(n - (2 * k - 2))]
	elif n % 2 == 0 and k % 2 == 0 or (n % 2 == 1 and k % 2 == 1):
		return [str(1)] * (k - 1) + [str(n - (k - 1))]
for t in range(T):
	a = ans(n[t], k[t])
	if a == 'NO':
		print('NO')
	else:
		print('YES')
		print(' '.join(a))


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	if n < k:
		print('NO')
		continue
	if k % 2 == 0 and n % 2 == 1:
		print('NO')
	elif k % 2 == 1 and n % 2 == 0:
		l = [2 for i in range(k - 1)] + [n - 2 * (k - 1)]
		if n - 2 * (k - 1) <= 0:
			print('NO')
			continue
		print('YES')
		print(*l)
	elif n % 2 == 0:
		l = [1 for i in range(k - 1)] + [n - (k - 1)]
		if (n - k + 1) % 2 == 0:
			print('NO')
		else:
			print('YES')
			print(*l)
	elif n % 2 == 1:
		l = [1 for i in range(k - 1)] + [n - k + 1]
		if (n - k + 1) % 2 == 0:
			print('NO')
		else:
			print('YES')
			print(*l)


for __ in range(int(input())):
	(n, k) = map(int, input().split())
	if n & 1 == 1:
		if k & 1 == 0:
			print('NO')
		elif n - k + 1 < 1:
			print('NO')
		else:
			print('YES')
			for i in range(k - 1):
				print(1, end=' ')
			print(n - k + 1)
	elif k & 1 == 0:
		if n - k + 1 < 1:
			print('NO')
		else:
			print('YES')
			for i in range(k - 1):
				print(1, end=' ')
			print(n - k + 1)
	elif n // 2 < k:
		print('NO')
	else:
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		print(n - 2 * (k - 1))


num = int(input())
while num > 0:
	num = num - 1
	(t, y) = input().split()
	t = int(t)
	y = int(y)
	c = t
	for i in range(1, y):
		t = t - 2
	for i in range(1, y):
		c = c - 1
	if t % 2 == 0 and t > 0:
		print('YES')
		for i in range(1, y):
			print('2', end=' ')
		print(t)
	elif c % 2 != 0 and c > 0:
		print('YES')
		for i in range(1, y):
			print('1', end=' ')
		print(c)
	else:
		print('NO')


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)

def ispal(s):
	for i in range(len(s) // 2 + 1):
		if s[i] != s[-i - 1]:
			return False
	return True
for _ in range(ii()):
	(n, k) = mi()
	if n - k + 1 > 0 and n - k + 1 & 1:
		print('YES')
		print(*[1] * (k - 1) + [n - k + 1])
	elif n - k * 2 + 2 > 0 and (n - k * 2 + 2) % 2 == 0:
		print('YES')
		print('2 ' * (k - 1) + str(n - k * 2 + 2))
	else:
		print('NO')


t = int(input())
while t > 0:
	t -= 1
	a = input().split()
	if int(a[0]) < int(a[1]):
		print('NO')
	elif int(a[1]) == 1:
		print('YES')
		print(int(a[0]))
	else:
		m = int(a[0]) - int(a[1])
		if m % 2 == 0:
			print('YES')
			for i in range(0, int(a[1])):
				if i == int(a[1]) - 1:
					print(1 + m)
				else:
					print(1, end=' ')
		elif m >= int(a[1]) and int(a[1]) % 2 == 1:
			print('YES')
			m -= int(a[1])
			for i in range(0, int(a[1])):
				if i == int(a[1]) - 1:
					print(2 + m)
				else:
					print(2, end=' ')
		else:
			print('NO')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	if n % 2 == 1 and k % 2 == 0 or k > n:
		print('NO')
	else:
		ch = -1
		if ch == -1 and n % 2 == 0:
			arr = [2] * (k - 1)
			last = n - 2 * (k - 1)
			arr.append(last)
			if last <= 0 or last % 2 == 1:
				ch = 1
			else:
				ch = 0
		if ch == 1 or ch == -1:
			arr = [1] * (k - 1)
			last = n - (k - 1)
			arr.append(last)
			if last <= 0 or last % 2 == 0:
				print('NO')
				ch = -1
			else:
				ch = 0
		if ch == 0:
			print('YES')
			for i in arr:
				print(i, end=' ')
			print()


def odd(n, k):
	h = n - k
	if h < 0 or h % 2 != 0:
		return None
	h = h // 2
	c = h // k
	d = h % k
	arr = [c] * k
	arr[-1] += d
	arr = list(map(lambda x: 2 * x + 1, arr))
	return arr

def even(n, k):
	if n % 2 != 0:
		return None
	h = n // 2
	c = h // k
	if h == 0 or c == 0:
		return None
	d = h % k
	arr = [c] * k
	arr[-1] += d
	arr = list(map(lambda x: 2 * x, arr))
	return arr
t = int(input())
for _ in range(t):
	(n, k) = tuple([int(e) for e in input().split()])
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
		continue
	haveSolution = False
	arr1 = odd(n, k)
	if arr1:
		haveSolution = True
	arr2 = even(n, k)
	if arr2:
		haveSolution = True
	if haveSolution:
		print('YES')
		arr = arr1
		if arr2:
			arr = arr2
		print(' '.join(list(map(str, arr))))
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = [int(x) for x in input().split()]
	m = n
	for i in range(k - 1):
		n -= 1
		m -= 2
	if n > 0 and n % 2 == 1:
		print('YES')
		print(*[1] * (k - 1), n)
		continue
	if m > 0 and m % 2 == 0:
		print('YES')
		print(*[2] * (k - 1), m)
		continue
	print('NO')


t = int(input())
while t > 0:
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
	else:
		x = n // k
		sum = x * k
		if sum == n:
			print('YES')
			for i in range(k):
				print(x, end=' ')
			print()
		else:
			dif = n - sum
			a = [x for i in range(k)]
			a[0] += dif
			for i in range(1, k):
				if a[0] % 2 == 0 and a[i] % 2 != 0 or (a[0] % 2 != 0 and a[i] % 2 == 0):
					if i % 2 == 0:
						a[i] -= 1
					else:
						a[i] += 1
			S = 0
			ispos = True
			for i in range(k):
				if a[i] == 0:
					ispos = False
					break
				S += a[i]
			if S == n and ispos:
				print('YES')
				for i in a:
					print(i, end=' ')
				print()
			else:
				print('NO')
	t -= 1


from math import *
for zz in range(int(input())):
	(n, k) = map(int, input().split())
	n1 = n - 2 * k
	n2 = n - k
	ha = False
	if n1 >= 0:
		ans = [2] * (k - 1)
		ans.append(n - 2 * (k - 1))
		if ans[-1] % 2 == 0:
			print('YES')
			print(*ans)
			ha = True
	if not ha and n2 >= 0:
		ans = [1] * (k - 1)
		ans.append(n - (k - 1))
		if ans[-1] % 2 == 1:
			print('YES')
			print(*ans)
			ha = True
	if not ha:
		print('NO')


m = int(input())
for i in range(m):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
	elif n % 2 == 1:
		if k % 2 == 1:
			ans = (k - 1) * '1 ' + str(n - k + 1)
			print('YES\n' + ans)
		else:
			print('NO')
	elif k % 2 == 0:
		f = n // k
		ost = n % k
		ans = (k - 1) * (str(f) + ' ') + str(f + ost)
		print('Yes\n' + ans)
	elif n < 2 * k:
		print('NO')
	else:
		ans = (k - 1) * '2 ' + str(n - 2 * (k - 1))
		print('YES\n' + ans)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	even = n
	even = even - (k - 1) * 2
	if even > 0 and even % 2 == 0:
		print('YES')
		print('2 ' * (k - 1) + str(even))
		continue
	odd = n
	odd = odd - (k - 1)
	if odd > 0 and odd % 2 != 0:
		print('YES')
		print('1 ' * (k - 1) + str(odd))
		continue
	print('NO')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def main():
	t = I()
	rr = []
	for _ in range(t):
		(n, k) = LI()
		if k == 1:
			rr.append('YES')
			rr.append(n)
			continue
		r = [0]
		if n % 2 == 0 and k % 2 == 1:
			r += [2] * (k - 1)
		else:
			r += [1] * (k - 1)
		r[0] = n - sum(r)
		if r[0] < 1 or r[0] % 2 != r[1] % 2:
			rr.append('NO')
			continue
		rr.append('YES')
		rr.append(JA(r, ' '))
	return JA(rr, '\n')
print(main())


import sys
from collections import Counter
inp = sys.stdin.readline
read = lambda : list(map(int, inp().strip().split()))

def a():
	ans = ''
	for _ in range(int(inp())):
		n = int(inp())
		tem = ''
		x = 0
		c = 0
		while n:
			if n % 10:
				c += 1
				tem += str(n % 10 * 10 ** x) + ' '
			x += 1
			n //= 10
		ans += str(c) + '\n' + tem + '\n'
	print(ans)

def b():
	ans = ''
	for _ in range(int(inp())):
		(n, k) = read()
		if n == k:
			ans += 'YES\n'
			ans += '1 ' * k + '\n'
		elif k > n:
			ans += 'NO\n'
		elif n % 2 == 0:
			if k <= n // 2:
				ans += 'YES\n'
				for i in range(k - 1):
					ans += '2 '
					n -= 2
				ans += str(n) + '\n'
			elif k % 2 == 0:
				ans += 'YES\n'
				for i in range(k - 1):
					ans += '1 '
					n -= 1
				ans += str(n) + '\n'
			else:
				ans += 'NO\n'
		elif k % 2 == 0:
			ans += 'NO\n'
		else:
			ans += 'YES\n'
			for i in range(k - 1):
				ans += '1 '
				n -= 1
			ans += str(n) + '\n'
	print(ans)

def c():
	ans = ''
	for _ in range(int(inp())):
		(k, n) = read()
		n += (n + n // k) // k
		if n % k == 0:
			n += 1
		ans += str(n) + '\n'
	print(ans)
b()


def fun(n, k):
	if k > n:
		return 'NO'
	if k % 2 == 0 and n % 2 == 1:
		return 'NO'
	if k % 2 == 1:
		if n % 2 == 1:
			ans = [1] * (k - 1) + [n - (k - 1)]
		else:
			if 2 * (k - 1) >= n:
				return 'NO'
			ans = [2] * (k - 1) + [n - 2 * (k - 1)]
	elif n % 2 == 1:
		return 'NO'
	else:
		ans = [1] * (k - 1) + [n - (k - 1)]
	return ans
for _ in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	x = fun(a, b)
	if x == 'NO':
		print(x)
	else:
		print('YES')
		print(' '.join([str(i) for i in x]))


t = int(input())
for w in range(t):
	nk = list(map(int, input().strip().split()))
	n = nk[0]
	k = nk[1]
	if n % 2 != 0:
		if k % 2 == 0:
			print('NO')
		elif n < k:
			print('NO')
		else:
			q = n // k
			p = q - (q % 2 == 0)
			arr = [p for j in range(k)]
			sum = p * k
			i = 0
			while sum < n:
				arr[i % k] += 2
				sum += 2
				i += 1
			print('YES')
			print(*arr)
	elif k % 2 == 0:
		if n < k:
			print('NO')
		else:
			q = n // k
			p = q - (q % 2 == 0)
			arr = [p for j in range(k)]
			sum = p * k
			i = 0
			while sum < n:
				arr[i % k] += 2
				sum += 2
				i += 1
			print('YES')
			print(*arr)
	elif n < 2 * k:
		print('NO')
	else:
		q = n // k
		p = q - (q % 2 != 0)
		arr = [p for j in range(k)]
		sum = p * k
		i = 0
		while sum < n:
			arr[i % k] += 2
			sum += 2
			i += 1
		print('YES')
		print(*arr)


t = int(input())
e = 10 ** 9 + 7
for _ in range(t):
	(n, k) = map(int, input().split())
	if n % 2:
		if k % 2:
			l = [1] * (k - 1) + [n - k + 1]
			if n - k + 1 < 1:
				print('NO')
			else:
				print('YES')
				print(*l)
		else:
			print('NO')
	else:
		l = [2] * (k - 1) + [n - 2 * k + 2]
		x = [1] * (k - 1) + [n - k + 1]
		if l[-1] > 0:
			print('YES')
			print(*l)
		elif x[-1] % 2 and x[-1] > 0:
			print('YES')
			print(*x)
		else:
			print('NO')


t = int(input())
for tt in range(t):
	(n, k) = [int(i) for i in input().split(' ')]
	a1 = n - (k - 1)
	if a1 % 2 == 1 and a1 > 0:
		print('YES')
		print(a1, end='')
		for i in range(k - 1):
			print('', 1, end='')
		print()
		continue
	a1 = n - (k - 1) * 2
	if a1 % 2 == 0 and a1 > 0:
		print('YES')
		print(a1, end='')
		for i in range(k - 1):
			print('', 2, end='')
		print()
		continue
	print('NO')


try:
	t = int(input())
	for i in range(t):
		(n, k) = map(int, input().split())
		x = n - (k - 1)
		y = n - 2 * (k - 1)
		if x % 2 != 0 and x > 0:
			print('YES')
			print('1 ' * (k - 1) + str(x))
		elif y % 2 == 0 and y > 0:
			print('YES')
			print('2 ' * (k - 1) + str(y))
		else:
			print('NO')
except:
	pass


import sys
t = int(input())
for i in range(t):
	(n, k) = map(int, sys.stdin.readline().strip().split())
	m = k - 1
	restungerade = n - m
	restgerade = n - 2 * m
	if restungerade > 0 and restungerade % 2:
		print('YES')
		print(' '.join(m * ['1'] + [str(restungerade)]))
	elif restgerade > 0 and (not restgerade % 2):
		print('YES')
		print(' '.join(m * ['2'] + [str(restgerade)]))
	else:
		print('NO')


t = int(input())
while t > 0:
	t = t - 1
	s = input().split(' ')
	(n, k) = (int(s[0]), int(s[1]))
	if n < k:
		print('NO')
		continue
	a = k - 1
	b = (k - 1) * 2
	a = n - a
	b = n - b
	if a % 2 != 0 and a > 0:
		print('YES')
		s = '1 ' * (k - 1)
		print(s, end='')
		print(a)
	elif b % 2 == 0 and b > 0:
		print('YES')
		s = '2 ' * (k - 1)
		print(s, end='')
		print(b)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	if n % 2 != 0:
		if k % 2 == 0:
			print('no')
		elif k > n:
			print('no')
		else:
			print('yes')
			ans = []
			for _ in range(k - 1):
				ans.append(1)
			ans.append(n - (k - 1))
			print(*ans)
	elif (n - (k - 1)) % 2 == 1 and n - k + 1 > 0:
		print('yes')
		for _ in range(k - 1):
			print(1, end=' ')
		print(n - k + 1)
	elif (n - (k - 1) * 2) % 2 == 0 and n - (k - 1) * 2 > 0:
		print('yes')
		for _ in range(k - 1):
			print(2, end=' ')
		print(n - (k - 1) * 2)
	else:
		print('no')


test = int(input())
for tes in range(test):
	(n, k) = list(map(int, input().split()))
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
	else:
		rem = n // k
		if rem == 0:
			print('NO')
			continue
		su = 0
		if k % 2 == 1:
			if n % 2 == 1:
				su += k
				diff = n - su
				if diff % 2 == 1 or diff < 0:
					print('NO')
				else:
					print('YES')
					L = [1 for i in range(k - 1)]
					L.append(diff + 1)
					print(*L)
			else:
				su += 2 * k
				diff = n - su
				if diff % 2 == 1 or diff < 0:
					print('NO')
				else:
					print('YES')
					L = [2 for i in range(k - 1)]
					L.append(diff + 2)
					print(*L)
		else:
			su += k
			diff = n - su
			if diff % 2 == 1 or diff < 0:
				print('NO')
			else:
				print('YES')
				L = [1 for i in range(k - 1)]
				L.append(diff + 1)
				print(*L)


for T in range(int(input())):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
		continue
	if (n - (k - 1)) % 2:
		s = '1 ' * (k - 1)
		print('YES')
		print(s[:len(s) - 1], n - (k - 1))
		continue
	if n > 2 * (k - 1) and (n - 2 * (k - 1)) % 2 == 0:
		s = '2 ' * (k - 1)
		print('YES')
		print(s[:len(s) - 1], n - 2 * (k - 1))
		continue
	print('NO')


import sys
input = sys.stdin.buffer.readline
from collections import defaultdict
con = 10 ** 9 + 7
INF = float('inf')

def getlist():
	return list(map(int, input().split()))

def main():
	N = int(input())
	for _ in range(N):
		(n, k) = getlist()
		if n - (k - 1) >= 1 and (n - (k - 1)) % 2 == 1:
			print('YES')
			ans = [1] * k
			ans[-1] = n - (k - 1)
			print(*ans)
		elif n - (k - 1) * 2 >= 2 and (n - (k - 1) * 2) % 2 == 0:
			print('YES')
			ans = [2] * k
			ans[-1] = n - (k - 1) * 2
			print(*ans)
		else:
			print('NO')
main()


testcases = int(input())
while testcases > 0:
	testcases = testcases - 1
	(n, k) = map(int, input().split())
	if n < k:
		print('NO')
		continue
	elif n == k:
		string = '1' * n
		print('YES')
		string = ''
		for i in range(0, k):
			string = string + ' ' + '1'
		print(string[1:])
		continue
	else:
		n1 = n - k + 1
		if n1 > 0 and n1 % 2 == 1:
			print('YES')
			string = ''
			for i in range(0, k - 1):
				string = string + ' ' + '1'
			string = string + ' ' + str(n1)
			print(string[1:])
			continue
		n2 = n - 2 * k + 2
		if n2 > 0 and n2 % 2 == 0:
			print('YES')
			string = ''
			for i in range(0, k - 1):
				string = string + ' ' + '2'
			string = string + ' ' + str(n2)
			print(string[1:])
			continue
		print('NO')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split(' '))
	if n % 2 and (not k % 2):
		print('NO')
		continue
	if not n % 2 and k % 2:
		if n < 2 * k:
			print('NO')
			continue
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		print(n - 2 * (k - 1))
		continue
	if n < k:
		print('NO')
		continue
	print('YES')
	for i in range(k - 1):
		print(1, end=' ')
	print(n - (k - 1))


for __ in range(int(input())):
	(n, k) = map(int, input().split(' '))
	n1 = n - (k - 1)
	if n1 > 0 and n1 % 2 == 1:
		print('Yes')
		for i in range(k - 1):
			print('1', end=' ')
		print(n1)
		continue
	n2 = n - 2 * (k - 1)
	if n2 > 0 and n2 % 2 == 0:
		print('Yes')
		for i in range(k - 1):
			print('2', end=' ')
		print(n2)
		continue
	print('No')


from sys import stdin

def solve(n, k):
	ans = 'NO'
	f = True
	if n % 2 == 1:
		if k % 2 == 1 and n >= k:
			f = False
			print('YES')
			for i in range(k - 1):
				print(1, end=' ')
				n -= 1
			print(n)
	else:
		if k % 2 == 1 and n >= 2 * k:
			f = False
			print('YES')
			for i in range(k - 1):
				print(2, end=' ')
				n -= 2
			print(n)
		if k % 2 == 0:
			if n >= k and n < 2 * k:
				f = False
				print('YES')
				for i in range(k - 1):
					print(1, end=' ')
					n -= 1
				print(n)
			if n >= 2 * k:
				f = False
				print('YES')
				for i in range(k - 1):
					print(2, end=' ')
					n -= 2
				print(n)
	if f:
		print('NO')
	return

def main():
	inp = stdin.readline
	for _ in range(int(inp())):
		(n, k) = map(int, inp().split())
		solve(n, k)
main()


for p in range(0, int(input())):
	b = input().split(' ')
	n = int(b[0])
	k = int(b[1])
	state = 'YES'
	if k % 2 == 0:
		if n - (k - 1) * 2 > 0 and n % 2 == 0:
			print('YES')
			for i in range(0, k - 1):
				print(2, end=' ')
			print(n - (k - 1) * 2)
		elif n - k + 1 > 0 and n % 2 == 0:
			print('YES')
			for i in range(0, k - 1):
				print(1, end=' ')
			print(n - k + 1)
		else:
			print('NO')
	elif n - (k - 1) > 0 and n % 2 == 1:
		print('YES')
		for i in range(0, k - 1):
			print(1, end=' ')
		print(n - k + 1)
	elif n % 2 == 0 and n - 2 * k + 2 > 0:
		print('YES')
		for i in range(0, k - 1):
			print(2, end=' ')
		print(n - 2 * k + 2)
	else:
		print('NO')


from sys import stdin, stdout
import collections
t = int(input())

def solve(n, k):
	if k > n:
		print('NO')
		return
	if n % k == 0:
		print('YES')
		print(' '.join([str(n // k)] * k))
		return
	if n % 2 == 1 and k % 2 == 0:
		print('NO')
		return
	if k == 1:
		print('YES')
		print(n)
		return
	if n % 2 == 0:
		ans = []
		ans += ['2'] * (k - 1)
		nx = n - (k - 1) * 2
		if nx <= 1 or nx % 2 == 1:
			pas = []
			pas += ['1'] * (k - 1)
			x = n - k + 1
			if x <= 0 or x % 2 == 0:
				print('NO')
				return
			pas += [str(x)]
			print('YES')
			print(' '.join(pas))
			return
		ans += [str(nx)]
		print('YES')
		print(' '.join(ans))
		return
	if n % 2 == 1 and k % 2 == 1:
		ans = []
		ans += ['1'] * (k - 1)
		nx = n - k + 1
		if nx <= 0:
			print('NO')
			return
		ans += [str(nx)]
		print('YES')
		print(' '.join(ans))
		return
	print('NO')
	return
for i in range(t):
	(n, k) = list(map(int, stdin.readline().split()))
	solve(n, k)


n = int(input())
for test in range(n):
	(m, k) = map(int, input().split())
	if m % 2 == 1 and k % 2 == 0:
		print('NO')
	elif m % 2 == 1 and k % 2 == 1 or (m % 2 == 0 and k % 2 == 0):
		l = ['1'] * (k - 1)
		m -= k - 1
		if m % 2 != 1 or m <= 0:
			print('NO')
		else:
			print('YES')
			l.append(str(m))
			print(' '.join(l))
	elif m % 2 == 0 and k % 2 == 1:
		l = ['2'] * (k - 1)
		m -= (k - 1) * 2
		if m % 2 != 0 or m <= 0:
			print('NO')
		else:
			print('YES')
			l.append(str(m))
			print(' '.join(l))


import sys, random
from bisect import bisect_left, bisect_right
input = sys.stdin.readline

def main():
	inf = 10 ** 20
	t = int(input())
	for _ in range(1, t + 1):
		(n, k) = map(int, input().split())
		if n & 1 and k & 1:
			if n >= k:
				print('YES')
				print('1 ' * (k - 1) + str(n - k + 1))
			else:
				print('NO')
		elif not n & 1 and (not k & 1):
			if n >= k:
				print('YES')
				print('1 ' * (k - 1) + str(n - k + 1))
			else:
				print('NO')
		elif not n & 1 and k & 1:
			if n >= k * 2:
				print('YES')
				print('2 ' * (k - 1) + str(n - 2 * (k - 1)))
			else:
				print('NO')
		else:
			print('NO')
main()


for t in range(int(input())):
	(n, k) = map(int, input().split())
	if k > n:
		print('NO')
	elif n == k:
		print('YES')
		r = [1] * n
		for i in r:
			print(i, end=' ')
		print()
	else:
		p = n // k
		if n % 2 == 0:
			if p % 2 == 1 and k % 2 != 0:
				p -= 1
		elif p % 2 == 0:
			p -= 1
		r = [p] * (k - 1)
		r.append(n - (k - 1) * p)
		rr = 0
		pp = 0
		f = 0
		for i in r:
			if i % 2 == 0:
				rr += 1
			else:
				pp += 1
			if i == 0:
				f = 1
				break
		if rr == k or (pp == k and f == 0):
			print('YES')
			for i in r:
				print(i, end=' ')
			print()
		else:
			print('NO')


T = int(input())
for _ in range(T):
	(n, k) = map(int, input().split())
	if n % 2 == 1:
		if k % 2 == 0:
			print('NO')
		elif k > n:
			print('NO')
		else:
			print('YES')
			ans = []
			for i in range(k - 1):
				print(1, end=' ')
			print(n - k + 1)
	elif k % 2 == 0:
		if k > n:
			print('NO')
		else:
			print('YES')
			for i in range(k - 1):
				print(1, end=' ')
			print(n - k + 1)
	elif 2 * k > n:
		print('NO')
	else:
		print('YES')
		for i in range(k - 1):
			print(2, end=' ')
		print(n - 2 * k + 2)


t = int(input(''))
while t:
	t -= 1
	(n, k) = map(int, input('').split())
	if n % 2 == 0:
		if k % 2 == 0:
			if k > n:
				print('NO')
			else:
				dat = [1] * (k - 1)
				dat.append(n - 1 * (k - 1))
				print('YES')
				print(' '.join(map(str, dat)))
		if k % 2 != 0:
			if 2 * k > n:
				print('NO')
			else:
				dat = [2] * (k - 1)
				dat.append(n - 2 * (k - 1))
				print('YES')
				print(' '.join(map(str, dat)))
	elif k % 2 == 0:
		print('NO')
	elif k > n:
		print('NO')
	else:
		dat = [1] * (k - 1)
		dat.append(n - 1 * (k - 1))
		print('YES')
		print(' '.join(map(str, dat)))