Polycarp took $n$ videos, the duration of the $i$-th video is $a_i$ seconds. The videos are listed in the chronological order, i.e. the $1$-st video is the earliest, the $2$-nd video is the next, ..., the $n$-th video is the last.

Now Polycarp wants to publish exactly $k$ ($1 \le k \le n$) posts in Instabram. Each video should be a part of a single post. The posts should preserve the chronological order, it means that the first post should contain one or more of the earliest videos, the second post should contain a block (one or more videos) going next and so on. In other words, if the number of videos in the $j$-th post is $s_j$ then:

  $s_1+s_2+\dots+s_k=n$ ($s_i>0$),  the first post contains the videos: $1, 2, \dots, s_1$;  the second post contains the videos: $s_1+1, s_1+2, \dots, s_1+s_2$;  the third post contains the videos: $s_1+s_2+1, s_1+s_2+2, \dots, s_1+s_2+s_3$;  ...  the $k$-th post contains videos: $n-s_k+1,n-s_k+2,\dots,n$. 

Polycarp is a perfectionist, he wants the total duration of videos in each post to be the same.

Help Polycarp to find such positive integer values $s_1, s_2, \dots, s_k$ that satisfy all the conditions above.


-----Input-----

The first line contains two integers $n$ and $k$ ($1 \le k \le n \le 10^5$). The next line contains $n$ positive integer numbers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 10^4$), where $a_i$ is the duration of the $i$-th video.


-----Output-----

If solution exists, print "Yes" in the first line. Print $k$ positive integers $s_1, s_2, \dots, s_k$ ($s_1+s_2+\dots+s_k=n$) in the second line. The total duration of videos in each post should be the same. It can be easily proven that the answer is unique (if it exists).

If there is no solution, print a single line "No".


-----Examples-----
Input
6 3
3 3 1 4 1 6

Output
Yes
2 3 1 
Input
3 3
1 1 1

Output
Yes
1 1 1 
Input
3 3
1 1 2

Output
No
Input
3 1
1 10 100

Output
Yes
3

Source: codeforces | Difficulty: EASY
Tags: Implementation


Solutions:
def main():
	(n, k) = map(int, input().split())
	v = list(map(int, input().split()))
	d = sum(v) / k
	j = 0
	res = ''
	sumpart = 0
	for i in range(len(v)):
		sumpart += v[i]
		if sumpart == d:
			res += str(i + 1 - j) + ' '
			j = i + 1
			sumpart = 0
			if j >= len(v):
				break
		elif sumpart > d:
			print('No')
			return
	res.rstrip()
	print('Yes')
	print(res)
main()


(n, k) = map(int, input().split())
L = list(map(int, input().split()))
p = sum(L)
if p % k == 0:
	M = []
	summa = 0
	count = 0
	f = True
	for i in L:
		if summa + i == p // k:
			M.append(count + 1)
			summa = 0
			count = 0
		elif summa + i > p // k:
			f = False
		else:
			summa += i
			count += 1
	if f and len(M) == k:
		print('Yes')
		print(*M)
	else:
		print('No')
else:
	print('No')


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
t = max(a)
c = 0
ct = 0
s = []
if k == 1:
	print('Yes')
	print(len(a))
elif n == k:
	if a.count(a[0]) == len(a):
		print('Yes')
		for i in range(k):
			print(1, end=' ')
	else:
		print('No')
else:
	ic = 0
	for i in a:
		ct += i
		if ct < t:
			if ic == n - 1:
				print('No')
				exit()
			c += 1
		elif ct == t:
			c += 1
			ct = 0
			s.append(c)
			c = 0
		else:
			print('No')
			exit()
		ic += 1
	if len(s) == k:
		print('Yes')
		for i in s:
			print(i, end=' ')
	else:
		print('No')


(n, k) = map(int, input().split())
v = list(map(int, input().split()))
rez = []
chk = False
if sum(v) % k != 0:
	chk = True
else:
	d = sum(v) // k
	s = 0
	c = 0
	for i in range(0, len(v)):
		s += v[i]
		c += 1
		if s == d:
			rez.append(c)
			s = 0
			c = 0
		elif s > d:
			chk = True
			break
if chk:
	print('No')
else:
	print('Yes')
	print(' '.join((str(e) for e in rez)))


(N, K) = map(int, input().split())
A = list(map(int, input().split()))
s = sum(A)
if s % K != 0:
	print('No')
	exit()
s = s // K
cnt = 0
tmp = 0
rec = []
for i in range(N):
	tmp += A[i]
	cnt += 1
	if tmp == s:
		rec.append(cnt)
		tmp = 0
		cnt = 0
	elif tmp > s:
		print('No')
		exit()
print('Yes')
print(' '.join(map(str, rec)))


I = lambda : map(int, input().split())
(n, k) = I()
A = list(I())
t = sum(A) // k
X = []
i = 0
for _ in range(k):
	s = A[i]
	x = 1
	while s < t:
		i += 1
		s += A[i]
		x += 1
	if s > t:
		print('No')
		break
	X.append(x)
	i += 1
else:
	if i < n:
		print('No')
	else:
		print('Yes')
		print(*X)


def run():
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	s = 0
	for x in a:
		s += x
	if s % k:
		print('No')
		return
	dur = s // k
	cs = 0
	ans = []
	for i in range(n):
		cs += a[i]
		if cs == dur:
			ans.append(i + 1)
			cs = 0
		elif cs > dur:
			print('No')
			return
	print('Yes')
	for i in range(len(ans) - 1, 0, -1):
		ans[i] = ans[i] - ans[i - 1]
	print(' '.join(map(str, ans)))
run()


(n, k) = map(int, input().split())
l = map(int, input().split())
l = [int(x) for x in l]
flag = True
result = []
if sum(l) % k != 0:
	flag = False
	print('No')
else:
	length = sum(l) / k
	s = 0
	for i in range(len(l)):
		s += l[i]
		if s > length:
			print('No')
			flag = False
			break
		elif s == length:
			result.append(i + 1)
			s = 0
	if flag == True:
		print('Yes')
		for i in range(len(result) - 1, 0, -1):
			result[i] -= result[i - 1]
		for number in result:
			print(number, end=' ')


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
z = sum(a)
if z % k != 0:
	print('No')
else:
	x = z // k
	c = []
	sm = []
	s = 0
	for i in range(n):
		s += a[i]
		if s == x:
			if len(c) == 0:
				c.append(i + 1)
			else:
				c.append(i + 1 - sm[-1])
			sm.append(i + 1)
			s = 0
	if len(c) == k:
		print('Yes')
		print(*c)
	else:
		print('No')


(n, k) = map(int, input().split())
a = [int(i) for i in input().split()]
sum_of_a = sum(a)
if sum_of_a % k != 0:
	print('No')
else:
	part_of_sum = sum_of_a // k
	counter = 0
	local_sum = 0
	flag = 0
	num_of_videos = []
	for num in a:
		if local_sum < part_of_sum:
			local_sum += num
			counter += 1
		elif local_sum == part_of_sum:
			num_of_videos.append(counter)
			counter = 1
			local_sum = num
		else:
			flag = 1
			break
	if local_sum == part_of_sum:
		num_of_videos.append(counter)
	else:
		flag = 1
	if flag == 0:
		print('Yes')
		print(*num_of_videos)
	else:
		print('No')


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
t = sum(a) // k
cur_s = 0
d = [0]
for x in a:
	cur_s += x
	d[-1] += 1
	if cur_s == t:
		cur_s = 0
		d.append(0)
if len(d) != k + 1 or sum(a) % k:
	print('No')
else:
	print('Yes')
	print(*d[:-1])


(videos, posts) = map(int, input().split())
times = list(map(int, input().split()))
if posts == 1:
	print('Yes')
	print(videos)
	quit()
total_duration = sum(times)
if total_duration % posts != 0:
	print('No')
	quit()
time_per_post = total_duration // posts
videos_per_post = []
count = 0
current_time = 0
for i in times:
	current_time += i
	count += 1
	if current_time > time_per_post:
		print('No')
		break
	elif current_time == time_per_post:
		videos_per_post.append(count)
		count = 0
		current_time = 0
else:
	print('Yes')
	print(' '.join(map(str, videos_per_post)))


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
l = sum(a)
if l % k != 0:
	print('No')
	exit()
else:
	z = l // k
	c = []
	h = 0
	q = 0
	for i in range(len(a)):
		q += a[i]
		if q == z:
			c.append(i + 1)
			q = 0
	c.reverse()
	for i in range(len(c) - 1):
		c[i] -= c[i + 1]
	c.reverse()
	if len(c) == k:
		print('Yes')
		print(*c)
	else:
		print('No')


(n, k) = map(int, input().split())
s = [int(x) for x in input().split()]
su = sum(s)
flag = 1
if su % k != 0:
	print('No')
else:
	v = su // k
	s1 = []
	a = 0
	cou = 0
	for i in range(n):
		cou += 1
		a += s[i]
		if a > v:
			print('No')
			flag = 0
			break
		elif a < v:
			continue
		elif a == v:
			a = 0
			s1.append(cou)
			cou = 0
	if a != 0:
		s1.append(su // v)
	if flag:
		print('Yes')
		print(*s1)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
each = sum(a) // k
r = []
s = 0
i = 0
m = 0
while i < n:
	s += a[i]
	m += 1
	if s == each:
		r.append(m)
		s = 0
		m = 0
	i += 1
if s == 0 and i == n and (m == 0) and (len(r) == k):
	print('Yes')
	for i in r:
		print(i, end=' ')
else:
	print('No')


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a)
if s % k != 0:
	print('No')
else:
	l = []
	s = s // k
	r = 0
	c = 0
	m = 0
	for i in range(n):
		r += a[i]
		c += 1
		if r == s:
			l.append(c)
			c = 0
			r = 0
			m += 1
	if m == k:
		print('Yes')
		for i in l:
			print(i, end=' ')
	else:
		print('No')


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
big = sum(a)
if big % k != 0:
	print('No')
else:
	j = big // k
	curr = 0
	vids = 0
	lens = []
	for guy in a:
		curr += guy
		vids += 1
		if curr == j:
			lens.append(vids)
			curr = 0
			vids = 0
		elif curr > j:
			print('No')
			break
	if len(lens) == k:
		out = ''
		for guy in lens:
			out += str(guy) + ' '
		print('Yes')
		print(out)


a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = sum(b) / a[1]
if sum(b) % a[1] != 0:
	print('No')
	quit()
i = 0
s = 0
l = 1
k = list()
while i < a[0]:
	s = s + b[i]
	if s < c:
		l += 1
		i += 1
		continue
	elif s > c:
		break
	else:
		k.append(l)
		l = 1
		s = 0
	i += 1
if i == a[0]:
	print('Yes')
	for p in k:
		print(p, end=' ')
else:
	print('No')


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a)
t = 0
p = 0
i = 0
res = []
poss = True
if s % k != 0:
	print('No')
else:
	while i != n:
		if t + a[i] <= s // k:
			t += a[i]
			p += 1
		else:
			poss = False
			break
		if t == s // k:
			res.append(p)
			t = 0
			p = 0
		i += 1
	if t != 0:
		poss = False
	if poss:
		print('Yes')
		print(' '.join(map(str, res)))
	else:
		print('No')


(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
s = sum(a)
b = []
count = 0
ind = -1
if s % k == 0:
	d = s // k
	for i in range(n):
		count += a[i]
		if count == d:
			b.append(i - ind)
			ind = i
			count = 0
	if len(b) == k:
		print('Yes')
		for j in b:
			print(j, end=' ')
	else:
		print('No')
else:
	print('No')


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
if sum(a) % k == 0 and sum(a) >= k:
	r = sum(a) // k
	c = 0
	ans = []
	(temp, flag) = (0, 0)
	for i in range(n):
		c += a[i]
		if c == r:
			ans.append(i + 1 - temp)
			temp = i + 1
			c = 0
		elif c > r:
			flag = 1
			break
		else:
			pass
	if flag == 0:
		print('Yes')
		print(*ans)
	else:
		print('No')
else:
	print('No')


def main():
	(m, k) = list(map(int, input().split()))
	array = list(map(int, input().split()))
	agg = sum(array)
	section_size = int(agg / k)
	blocks = []
	curr_sum = 0
	curr_block = 0
	is_feasible = True
	if agg % k != 0:
		is_feasible = False
	for i in array:
		curr_sum += i
		curr_block += 1
		if curr_sum == section_size:
			curr_sum = 0
			blocks.append(curr_block)
			curr_block = 0
		elif curr_sum > section_size or is_feasible == False:
			is_feasible = False
			break
	if is_feasible:
		print('Yes')
		str1 = ' '.join((str(e) for e in blocks))
		print(str1)
	else:
		print('No')
main()


[n, k] = [int(x) for x in input().split(' ')]
a = [int(x) for x in input().split(' ')]
duration = sum(a) / k
if not duration.is_integer():
	print('No')
else:
	s = k * [0]
	d_now = 0
	index = 0
	for i in range(0, n):
		d_now += a[i]
		s[index] += 1
		if d_now < duration:
			continue
		elif d_now == duration:
			index += 1
			d_now = 0
		else:
			print('No')
			break
		if i == n - 1:
			print('Yes')
			print(' '.join((str(x) for x in s)))


(n, k) = [int(s) for s in input().split()]
s = [0 for i in range(k)]
a = [int(s) for s in input().split()]
b = [0 for i in range(n)]
b[0] = a[0]

def check():
	for i in range(1, n):
		b[i] = b[i - 1] + a[i]
	cnt = 0
	if b[n - 1] % k != 0:
		print('No')
		return
	m = b[n - 1] / k
	for j in range(0, n):
		if b[j] % m == 0:
			s[cnt] = j
			cnt += 1
	if cnt >= k:
		print('Yes')
		for i in range(k):
			if i == 0:
				print(s[i] + 1, end=' ')
			else:
				print(s[i] - s[i - 1], end=' ')
		return
	else:
		print('No')
		return
check()


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

def solve(n, k, A):
	if sum(A) % k != 0:
		print('No')
		return
	target = sum(A) // k
	(ans, elems, sm) = ([], 0, 0)
	for num in A:
		sm += num
		elems += 1
		if sm > target:
			print('No')
			return
		if sm == target:
			ans.append(elems)
			(elems, sm) = (0, 0)
	print('Yes')
	print(' '.join(map(str, ans)))
(n, k) = read()
A = read()
solve(n, k, A)


(n, k) = map(int, input().split())
a = list(map(int, input().split())) + [0]
pre = [-1]
s = 0
su = 0
for i in a:
	s += i
	su += i
	pre.append(s)
if su % k:
	print('No')
else:
	x = su // k
	f = 0
	l = []
	for i in range(1, n + 1):
		if pre[i] % x == 0:
			if f:
				l.append(i - z)
				z = i
			else:
				l.append(i)
				z = i
				f = 1
	if len(l) == k:
		print('Yes')
		print(' '.join([str(i) for i in l]))
	else:
		print('No')


(n, t) = map(int, input().split())
l = list(map(int, input().split()))
test = 1
s = sum(l)
v = s / t
if s % t != 0:
	print('No')
	test = 0
(i, j) = (0, 0)
f = []
while test and i < len(l):
	a = 0
	while a < v:
		a += l[i]
		i += 1
	if a > v:
		print('No')
		test = 0
	else:
		f.append(i + 1 - j - 1)
		j = i
if test:
	print('Yes')
	print(*(_ for _ in f))


(n, k) = map(int, input().split())
vids = [int(bruh) for bruh in input().split()]
len = 0
cnt = 0
res = []
summy = sum(vids) / k
for x in range(n):
	len += vids[x]
	cnt += 1
	if len == summy:
		res.append(cnt)
		cnt = 0
		len = 0
	elif len > summy:
		print('No')
		exit()
print('Yes')
res1 = [str(bruhh) for bruhh in res]
print(' '.join(res1))


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
c = sum(l) / k
if c.is_integer() == False:
	print('No')
	exit()
t = p = 0
le = []
for x in l:
	t += x
	p += 1
	if t == int(c):
		le.append(p)
		t = 0
		p = 0
if len(le) == k:
	print('Yes')
	print(' '.join([str(elem) for elem in le]))
else:
	print('No')


(n, k) = list(map(int, input().strip().split()))
A = list(map(int, input().strip().split()))
s = sum(A)
t = s // k
if s % t != 0:
	print('No')
else:
	final = []
	i = 0
	flag = True
	while i != n:
		s1 = 0
		temp = []
		while s1 < t and i < n:
			s1 += A[i]
			temp.append(A[i])
			i += 1
		if s1 != t:
			flag = False
			break
		else:
			final.append(len(temp))
	if flag is False:
		print('No')
	else:
		print('Yes')
		print(' '.join(list(map(str, final))))


def main():
	(n, k) = map(int, input().split(' '))
	a = list(map(int, input().split(' ')))
	acc = sum(a)
	if acc % k != 0:
		print('No')
		return 0
	part = acc // k
	s = 0
	tmp = 0
	res = []
	for i in range(n):
		s += 1
		tmp += a[i]
		if tmp == part:
			res.append(s)
			s = 0
			tmp = 0
		elif tmp > part:
			print('No')
			return 0
	print('Yes')
	print(*res)
	return 0
exit(main())


import sys
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
if sum(l) % k:
	print('No')
else:
	curr = 0
	c = 0
	ans = []
	need = sum(l) // k
	for i in range(n):
		curr += l[i]
		c += 1
		if curr == need:
			ans.append(c)
			curr = 0
			c = 0
		elif curr > need:
			print('No')
			sys.exit(0)
	print('Yes')
	print(*ans)


(n, k) = map(int, input().split())
l = [*map(int, input().split())]
s = sum(l)
res = []
if s % k == 0:
	s //= k
	curr = 0
	prev = 0
	for (i, e) in enumerate(l):
		curr += e
		if curr == s:
			res.append(str(i - prev + 1))
			prev = i + 1
			curr = 0
		if curr > s:
			res = []
			break
	if curr != 0:
		res = []
if len(res) != k:
	print('No')
else:
	print('Yes')
	print(' '.join(res))


v = []
(n, k) = map(int, input().split())
s = 0
v = [int(x) for x in input().split()]
s = sum(v)
w = []
if s % k != 0:
	print('No')
else:
	ss = s // k
	i = 0
	m = 0
	sm = 0
	while i < n:
		m = 0
		sm = 0
		while i < n and sm < ss:
			sm += v[i]
			m += 1
			i += 1
		if sm > ss:
			print('No')
			break
		else:
			w.append(m)
	else:
		print('Yes')
		for i in range(len(w)):
			print(w[i], end=' ')


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
sums = sum(a)
if sums / k != sums // k:
	print('No')
else:
	check = False
	sums //= k
	A = []
	cnt = a[0]
	cnt1 = 1
	for i in range(1, n):
		if cnt < sums:
			cnt += a[i]
			cnt1 += 1
		elif cnt == sums:
			A.append(cnt1)
			cnt = a[i]
			cnt1 = 1
		else:
			check = True
			break
	if cnt == sums:
		A.append(cnt1)
	elif cnt > sums:
		check = True
	if check:
		print('No')
	else:
		print('Yes')
		for i in A:
			print(i, end=' ')
		print()


(n, k) = map(int, input().split())
sp = list(map(int, input().split()))
s = sum(sp) // k
s1 = []
(ans, sm) = (0, 0)
for el in sp:
	sm += el
	ans += 1
	if sm == s:
		s1.append(ans)
		(ans, sm) = (0, 0)
	elif sm > s:
		print('No')
		break
else:
	if sum(s1) == n:
		print('Yes')
		print(*s1)
	else:
		print('No')


from operator import add
from itertools import accumulate
inf = float('inf')
ip = lambda : input()
ii = lambda : int(input())
r = lambda : map(int, input().split())
rr = lambda : list(r())
(n, k) = r()
arr = rr()
if sum(arr) % k:
	print('No')
	exit()
each = sum(arr) // k
arr = list(accumulate(arr, add))
x = 1
ans = [0]
for (i, j) in enumerate(arr, 1):
	if j == x * each:
		x += 1
		ans.append(i)
if x != k + 1:
	print('No')
	exit()
print('Yes')
ans = ans[::-1]
for i in range(len(ans) - 1):
	ans[i] -= ans[i + 1]
print(*ans[:-1][::-1])


from sys import stdin, stdout
from math import sqrt
import math
import heapq
from itertools import accumulate
(N, K) = [int(x) for x in stdin.readline().split()]
arr = [int(x) for x in stdin.readline().split()]
summ = sum(arr)
if summ % K != 0:
	print('No')
	quit()
div = summ // K
s = 0
ans = []
k = 0
for i in range(N):
	s += arr[i]
	k += 1
	if s == div:
		ans.append(k)
		s = 0
		k = 0
	if s > div:
		print('No')
		quit()
print('Yes')
print(*ans)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
ansarr = []
m = 0
su = 0
ans = 0
s = sum(arr)
le = s // k
if s % k != 0:
	print('No')
	return
else:
	for i in range(n):
		su += arr[m]
		m += 1
		ans += 1
		if su == le:
			ansarr.append(ans)
			ans = 0
			su = 0
		elif su > le:
			print('No')
			return
print('Yes')
print(*ansarr)


(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
s = sum(a)
if s % k != 0:
	print('No')
	return
rvl = s // k
vip = []
tvip = 0
tvipl = 0
for cv in range(n):
	tvip += 1
	tvipl += a[cv]
	if tvipl > rvl:
		print('No')
		return
	elif tvipl == rvl:
		vip.append(tvip)
		tvip = 0
		tvipl = 0
print('Yes')
print(*vip, sep=' ')


import sys
(n, k) = map(int, sys.stdin.readline().split())
arr = list(map(int, sys.stdin.readline().split()))
if sum(arr) % k != 0:
	print('No')
else:
	find = True
	temp = sum(arr) // k
	now = 0
	size = 0
	res = []
	for i in range(n):
		if now + arr[i] <= temp:
			now += arr[i]
			size += 1
		else:
			res.append(size)
			size = 1
			now = arr[i]
	if now == temp:
		res.append(size)
	for i in res:
		if i == 0 or i > n:
			find = False
	if len(res) != k:
		find = False
	if find:
		print('Yes')
		print(' '.join(map(str, res)))
	else:
		print('No')


import sys
(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
s = sum(a)
if s % k != 0:
	print('No')
	return
tot = s // k
ans = []
cur = 0
cursum = 0
for i in a:
	cursum += i
	cur += 1
	if cursum > tot:
		print('No')
		return
	elif cursum == tot:
		ans.append(cur)
		cur = 0
		cursum = 0
if cur != 0:
	print('No')
	return
print('Yes')
for i in ans:
	print(i, end=' ')


(n, k) = [int(x) for x in input().split()]
arr = [int(x) for x in input().split()]
s = sum(arr)
if s % k != 0:
	print('No')
else:
	d = s // k
	ans = []
	curr = 0
	t = 0
	flag = True
	for i in arr:
		curr += i
		t += 1
		if curr == d:
			ans.append(t)
			t = 0
			curr = 0
		elif curr > d:
			flag = False
			break
	if flag:
		print('Yes')
		for i in ans:
			print(i, end=' ')
	else:
		print('No')


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
if 1 == k:
	print('Yes')
	print(n)
	exit(0)
su = sum(l)
if su % k != 0:
	print('No')
	exit(0)
k1 = su // k
t = 0
k2 = 0
j1 = []
for i in l:
	t = t + i
	k2 += 1
	if t == k1:
		j1.append(k2)
		k2 = 0
		t = 0
	if t > k1:
		exit(print('No'))
print('Yes')
print(*j1)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
s = sum(l)
p = s / k
if p != int(p):
	print('No')
else:
	p = int(p)
	a = 0
	sum1 = 0
	flag = 1
	A = []
	b = 0
	for i in range(n):
		sum1 = sum1 + l[i]
		b = b + 1
		if i == n - 1 and sum1 < p:
			flag = 0
			break
		if sum1 == p:
			sum1 = 0
			a = a + 1
			A.append(b)
			b = 0
		elif sum1 > p:
			flag = 0
			break
	if flag == 1:
		print('Yes')
		print(*A)
	else:
		print('No')


def main():
	(a, b) = map(int, input().split())
	l = list(map(int, input().split()))
	s = sum(l)
	arr = []
	d = int(s / b)
	cs = 0
	ca = 0
	flag = 1
	if s % b != 0:
		flag = 0
	for i in l:
		cs += i
		ca += 1
		if cs == d:
			cs = 0
			arr.append(ca)
			ca = 0
		elif cs > d or flag == 0:
			flag = 0
			break
	if flag:
		print('Yes')
		str1 = ' '.join((str(e) for e in arr))
		print(str1)
	else:
		print('No')
main()


(n, k) = map(int, input().split())
s = [int(x) for x in input().split()]
sm = sum(s)
flag = 1
if sm % k != 0:
	print('No')
else:
	vh = sm // k
	s1 = []
	acummu = 0
	count = 0
	for i in range(n):
		count += 1
		acummu += s[i]
		if acummu > vh:
			print('No')
			flag = 0
			break
		elif acummu < vh:
			continue
		elif acummu == vh:
			acummu = 0
			s1.append(count)
			count = 0
	if acummu != 0:
		s1.append(sm // vh)
	if flag:
		print('Yes')
		print(*s1)


def shave(xs, target):
	count = 0
	total = 0
	while xs and total < target:
		total += xs.pop()
		count += 1
	return count if total == target else -1

def solve(k, xs):
	total = sum(xs)
	if total % k != 0:
		return []
	d = total // k
	ss = []
	while xs:
		s = shave(xs, d)
		if s == -1:
			return []
		ss.append(s)
	return ss

def main():
	(n, k) = [int(s) for s in input().split()]
	xs = [int(s) for s in reversed(input().split())]
	ss = solve(k, xs)
	if ss:
		print('Yes')
		print(' '.join((str(s) for s in ss)))
	else:
		print('No')
main()


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
c = sum(a)
if c % k == 0:
	zz = []
	ww = 0
	d = int(c / k)
	x = 0
	w = 0
	for i in range(0, n):
		x += a[i]
		y = i + 1
		if x == d:
			zz.append(y - w)
			x = 0
			w = i + 1
		elif x < d:
			continue
		else:
			ww = 1
			print('No')
			break
	if ww == 0:
		print('Yes')
		for i in range(0, len(zz)):
			print(zz[i], end=' ')
else:
	print('No')


(n, k) = map(int, input().split())
t = list(map(int, input().split()))
t_sum = sum(t)
if t_sum % k != 0:
	print('No')
	exit()
szuk = t_sum / k
tmp_num = 0
c = 0
t_wyn = []
xx = 0
for x in range(0, len(t), +1):
	tmp_num += t[x]
	if tmp_num == szuk:
		if len(t_wyn) == 0:
			t_wyn.append(str(x + 1))
			xx += x + 1
		else:
			t_wyn.append(str(x + 1 - xx))
			xx += int(t_wyn[-1])
		tmp_num = 0
		c += 1
		if c > k:
			print('No')
			exit(0)
		continue
	if tmp_num > szuk:
		print('No')
		exit(0)
print('Yes')
print(' '.join(t_wyn))


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
ans = []
f = 0
tmp = 0
c = 0
average = sum(l) // k
for i in l:
	tmp += i
	c += 1
	if tmp == average:
		ans.append(c)
		tmp = c = 0
	elif tmp > average:
		f = 1
		break
if f == 1 or len(ans) != k or average != sum(l) / k:
	print('No')
else:
	print('Yes')
	for i in ans:
		print(i, end=' ')


(n, t) = map(int, input().split())
l = list(map(int, input().split()))
su = sum(l)
ti = su // t
(flag, urr, num) = (0, 0, 0)
ans = []
if ti * t != su:
	flag = 1
for i in l:
	urr += i
	num += 1
	if urr == ti:
		urr = 0
		ans.append(num)
		num = 0
	if urr > ti:
		flag = 1
if flag == 1:
	print('No')
else:
	print('Yes')
	for i in ans:
		print(i, end=' ')


(vid, post) = map(int, input().split())
dura = [0 for i in range(vid)]
dura = input().split()
for i in range(vid):
	dura[i] = int(dura[i])
l = [0 for i in range(len(dura))]
total_dura = sum(dura)
if total_dura % post != 0:
	print('No')
else:
	summ = 0
	kill = [0 for i in range(post)]
	cout = 0
	pin = 0
	perin = True
	for i in range(len(dura)):
		summ += dura[i]
		cout += 1
		if summ == total_dura // post:
			summ = 0
			kill[pin] = cout
			cout = 0
			pin += 1
		elif summ > total_dura // post:
			perin = False
			break
	if perin == False:
		print('No')
	else:
		print('Yes')
		for i in range(post):
			print(kill[i], end=' ')


(n, m) = map(int, input().split())
s = list(map(int, input().split()))
a = sum(s)
r = ''
if a % m == 0:
	a1 = a // m
	b = 0
	c = 0
	for i in range(n):
		b += s[i]
		c += 1
		if b == a1:
			r += str(c) + ' '
			(b, c) = (0, 0)
		elif b < a1:
			pass
		else:
			print('No')
			exit(0)
	print('Yes')
	print(r[:-1])
else:
	print('No')


import sys
(n, k) = map(int, input().split())
a = [int(x) for x in input().split()]
s = sum(a)
if s % k != 0:
	print('No')
	sys.exit()
p = s // k
i = 0
c = 0
prev = -1
res = []
while i < n:
	c += a[i]
	if c == p:
		res.append(i - prev)
		c = 0
		prev = i
		i += 1
		continue
	if c < p:
		i += 1
	else:
		print('No')
		sys.exit()
print('Yes')
for i in res:
	print(i, end=' ')


temp = input().split(' ')
n = int(temp[0])
k = int(temp[1])
temp = input().split(' ')
mas = []
sum = 0
for i in range(n):
	mas.append(int(temp[i]))
for i in range(n):
	sum += mas[i]
d = 0
if sum % k:
	print('No')
	return
else:
	d = sum / k
rez = []
rez.append(0)
temp = 0
for i in range(n):
	temp += mas[i]
	if temp == d:
		temp = 0
		rez.append(i + 1)
	if temp > d:
		print('No')
		return
print('Yes')
for i in range(1, len(rez)):
	print(rez[i] - rez[i - 1], end=' ')


(n, k) = list(map(int, input().split()))
s = list(map(int, input().split()))
t = sum(s)
if t % k:
	print('No')
else:
	d = t // k
	res = []
	(temp, j, f) = (0, 0, 1)
	for i in range(n):
		temp += s[i]
		j += 1
		if temp == d:
			res.append(j)
			(temp, j) = (0, 0)
		elif temp > d:
			print('No')
			f = 0
			break
	if f:
		print('Yes')
		for i in res:
			print(i, end=' ')


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
f = 0
b = []
p = sum(a) // k
q = 0
c = 0
for i in a:
	q += i
	c += 1
	if p == q:
		b.append(c)
		c = 0
		q = 0
	elif q > p:
		f = 1
		break
if f == 1 or len(b) != k or p != sum(a) / k:
	print('No')
else:
	print('Yes')
	for i in b:
		print(i, end=' ')


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
l = sum(arr)
if l % k == 0:
	count = l // k
	a = [-1] * (k + 1)
	j = 1
	i = 0
	ptr1 = 0
	flag = 0
	while i < k:
		temp = 0
		while ptr1 < n:
			temp += arr[ptr1]
			if temp == count:
				a[j] = ptr1
				j += 1
				ptr1 += 1
				break
			elif temp > count:
				flag = 1
				break
			ptr1 += 1
		if temp < count:
			flag = 1
		if flag == 1:
			break
		i += 1
	if flag == 1:
		print('No')
	else:
		print('Yes')
		for i in range(1, k + 1):
			print(a[i] - a[i - 1], end=' ')
		print()
else:
	print('No')


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
s = sum(l)
if s % k != 0:
	print('No')
else:
	res = []
	target = s // k
	flag = True
	i = 0
	while i < n:
		cur = 0
		j = i
		while j < n and cur < target:
			cur += l[j]
			j += 1
		if cur > target:
			flag = False
			break
		res.append(j - i)
		i = j
	if flag:
		print('Yes')
		print(*res)
	else:
		print('No')


(n, k) = map(int, input().split())
s = list(map(int, input().split()))
_sum = sum(s)
if _sum % k != 0:
	print('No')
	exit(0)
V = _sum // k
idx = 0
current_val = 0
count = 0
ans = []
while idx < len(s):
	current_val += s[idx]
	count += 1
	if current_val > V:
		print('No')
		exit(0)
	elif current_val == V:
		ans.append(count)
		count = 0
		current_val = 0
	idx += 1
print('Yes')
print(' '.join(list(map(str, ans))))


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
sum = 0
for i in range(n):
	sum += arr[i]
ok = 1
part_sum = sum // k
if sum % k != 0:
	ok = 0
ind = 0
ans = []
for i in range(k):
	cur = 0
	prev_ind = ind
	while ind < n and cur < part_sum:
		cur += arr[ind]
		ind += 1
	if cur != part_sum:
		ok = 0
		break
	ans.append(ind - prev_ind)
if not ok:
	print('No')
else:
	print('Yes')
	print(*ans)


(n, k) = map(int, input().split())
s = list(map(int, input().split()))
t = sum(s) / k
if sum(s) % k != 0:
	print('No')
else:
	answ = []
	summ = 0
	kk = 0
	m = True
	for el in s:
		summ += el
		kk += 1
		if summ == t:
			answ.append(str(kk))
			summ = 0
			kk = 0
		elif summ > t:
			m = False
			break
	if m:
		print('Yes')
		print(' '.join(answ))
	else:
		print('No')


import sys
(n, k) = map(int, sys.stdin.readline().split())
arr = list(map(int, sys.stdin.readline().split()))
tot = sum(arr)
if tot % k != 0:
	print('No')
	sys.exit(0)
tot //= k
(idx, cur) = (0, 0)
ans = []
for i in range(n):
	cur += arr[i]
	idx += 1
	if cur == tot:
		ans.append(idx)
		idx = 0
		cur = 0
	elif cur > tot:
		print('No')
		sys.exit(0)
if sum(ans) != n:
	print('No')
	sys.exit(0)
print('Yes')
for an in ans:
	print(an, end=' ')


first_line = [int(x) for x in input().split()]
videos = [int(x) for x in input().split()]
n = first_line[0]
k = first_line[1]
s = sum(videos)
if s % k == 0:
	block_sum = s / k
	current_sum = 0
	posts = []
	index = 1
	for video in videos:
		current_sum += video
		if current_sum == block_sum:
			posts.append(index)
			current_sum = 0
			index = 1
		else:
			index += 1
	if len(posts) == k:
		print('Yes')
		print(*posts)
	else:
		print('No')
else:
	print('No')


(n, k) = map(int, input().split())
a = [int(z) for z in input().split()] + [0]
cnt = 0
x = 0
s = sum(a) / k
A = []
for i in range(1 + n):
	if cnt < s:
		cnt += a[i]
		x = x + 1
	elif cnt == s:
		A.append(x)
		cnt = a[i]
		x = 1
	else:
		x = -1
		A.clear()
		break
print('YNeos'[x < 0::2])
if len(A):
	print(*A, sep=' ')


import re
import sys
exit = sys.exit
from bisect import bisect_left as bsl, bisect_right as bsr
from collections import Counter, defaultdict as ddict, deque
from functools import lru_cache
cache = lru_cache(None)
from heapq import *
from itertools import *
from math import inf
from pprint import pprint as pp
enum = enumerate
ri = lambda : int(rln())
ris = lambda : list(map(int, rfs()))
rln = sys.stdin.readline
rl = lambda : rln().rstrip('\n')
rfs = lambda : rln().split()
mod = 1000000007
d4 = [(0, -1), (1, 0), (0, 1), (-1, 0)]
d8 = [(-1, -1), (0, -1), (1, -1), (-1, 0), (1, 0), (-1, 1), (0, 1), (1, 1)]
(n, k) = ris()
a = ris()
s = sum(a)
if s % k:
	print('No')
	exit()
m = s // k
ans = []
cnt = cur = 0
for x in a:
	cur += x
	if cur > m:
		print('No')
		exit()
	cnt += 1
	if cur == m:
		ans.append(cnt)
		cnt = cur = 0
print('Yes')
print(*ans)


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
if k == 1:
	print('Yes')
	print(n)
elif sum(a) % k == 0:
	s = sum(a) // k
	i = 0
	b = [0]
	t = True
	while i < n:
		while sum(a[b[-1]:i]) < s and i < n:
			i += 1
		if sum(a[b[-1]:i]) != s:
			print('No')
			t = False
			break
		else:
			b.append(i)
	if t:
		print('Yes')
		c = [b[x] - b[x - 1] for x in range(1, len(b))]
		print(' '.join(list(map(str, c))))
else:
	print('No')


(n, k) = map(int, input().split())
d = list(map(int, input().split()))
total = sum(d)
tab = []
tab2 = []
som = 0
nbV = 0
for d0 in d:
	som += d0
	nbV += 1
	tab.append(som)
	tab2.append(nbV)
answer_list = []
if total % k != 0:
	print('No')
else:
	d_unit = total // k
	u0 = d_unit
	v_cpt = 0
	while u0 <= total:
		if u0 > total:
			break
		if not u0 in tab:
			break
		ind = tab.index(u0)
		answer_list.append(tab2[ind] - v_cpt)
		v_cpt = tab2[ind]
		u0 += d_unit
	if u0 > total:
		print('Yes')
		print(*answer_list, sep=' ')
	else:
		print('No')


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
x = sum(a)
if x % k != 0:
	print('No')
	exit(0)
x = sum(a) // k
ans = []
(i, cur, cnt) = (0, 0, 0)
while i < n:
	if cur < x:
		cur += a[i]
		cnt += 1
	if cur > x:
		print('No')
		exit(0)
	if cur == x:
		ans.append(cnt)
		cnt = 0
		cur = 0
	i += 1
if cnt != 0:
	if cur != x:
		print('No')
		exit(0)
	ans.append(cnt)
print('Yes')
print(*ans)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
sum = 0
for i in a:
	sum += i
if sum % k:
	print('No')
	exit()
prt = sum // k
lst = 0
b = []
for i in range(n):
	if a[i] <= prt:
		prt -= a[i]
		if prt == 0:
			prt = sum // k
			b.append(i - lst + 1)
			lst = i + 1
	elif prt > 0:
		print('No')
		exit()
print('Yes')
print(*b, end=' ')


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
summ = sum(l)
flag = True
tedad = []
if summ % k == 0 and n != 1:
	temp = l[0]
	t = 1
	for q in range(1, n):
		if temp == summ / k:
			tedad.append(t)
			t = 0
			temp = 0
		elif temp > summ / k:
			print('No')
			flag = False
			break
		temp += l[q]
		t += 1
		if q == n - 1:
			if temp == summ / k:
				tedad.append(t)
			else:
				print('No')
				flag = False
				break
	if flag:
		print('Yes')
		for i in tedad:
			print(i, end=' ')
elif n == 1:
	if k == 1:
		print('Yes')
		print(1)
	else:
		print('No')
else:
	print('No')


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
tmp = sum(a) / k
if tmp != int(tmp):
	print('No')
	exit()
ans = 0
cnt = 0
res = []
for i in a:
	ans += i
	cnt += 1
	if ans > tmp:
		print('No')
		exit()
	if ans == tmp:
		res.append(cnt)
		cnt = 0
		ans = 0
print('Yes')
print(*res)


(n, k) = map(int, input().split())
ar = list(map(int, input().split()))
sigma = sum(ar)
if sigma % k != 0:
	print('No')
else:
	cs = 0
	st = ['0']
	pt = 0
	for i in range(len(ar)):
		cs += ar[i]
		if cs == sigma // k:
			st.append(str(i + 1 - pt))
			pt = i + 1
			cs = 0
	if len(st) == k + 1:
		print('Yes')
		print(' '.join(st[1:]))
	else:
		print('No')


(n, k) = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
res = 0
if sum(a) % k != 0:
	print('No')
else:
	suma = sum(a) // k
	no = []
	temp = 0
	cnt = 0
	for i in range(n):
		temp += a[i]
		cnt += 1
		if temp > suma:
			print('No')
			exit()
		elif temp == suma:
			no.append(cnt)
			cnt = 0
			temp = 0
	print('Yes')
	print(*no)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
val = sum(arr)
if val % k != 0:
	print('No')
else:
	flag = 0
	i = 0
	arr1 = []
	sumx = 0
	count = 0
	while i < n:
		sumx += arr[i]
		count += 1
		if sumx == val // k:
			arr1.append(count)
			sumx = 0
			count = 0
		elif sumx > val // k:
			flag = 1
			break
		i += 1
	if flag == 1:
		print('No')
	else:
		print('Yes')
		print(*arr1)


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
(n, k) = f()
l = il()
fl = 1
l1 = []
sm = sum(l)
if sm % k != 0:
	fl = 0
d = sm // k
x = 0
c = 0
for i in range(n):
	x += l[i]
	c += 1
	if x == d:
		l1.append(c)
		x = 0
		c = 0
if len(l1) == k and fl == 1:
	print('Yes')
	print(*l1)
else:
	print('No')


(n, k) = map(int, input().split())
dur = list(map(int, input().split()))
s = sum(dur)
f = True
if s % k == 0:
	s //= k
	cur = 0
	t = []
	counter = 0
	for i in dur:
		cur += i
		counter += 1
		if cur == s:
			cur = 0
			t.append(counter)
			counter = 0
		elif cur > s:
			print('No')
			f = False
			break
	if f:
		print('Yes')
		print(*t)
elif f:
	print('No')


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a)
if s % k > 0:
	print('No')
else:
	p = s / k
	ar = []
	cur = 0
	l = 0
	for i in range(n):
		if a[i] + cur == p:
			ar.append(i - l + 1)
			l = i + 1
			cur = 0
			continue
		cur += a[i]
		if cur > p:
			print('No')
			break
	else:
		print('Yes')
		print(*ar)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
ss = sum(l) // k
nums = []
s = 0
i = 0
cnt = 0
while i < n:
	s += l[i]
	cnt += 1
	if s == ss:
		nums.append(cnt)
		s = 0
		cnt = 0
	i += 1
if s == 0 and i == n and (cnt == 0) and (len(nums) == k):
	print('Yes')
	for num in nums:
		print(num, end=' ')
else:
	print('No')


def main():
	(n, k) = (int(x) for x in input().split())
	l = [int(x) for x in input().split()]
	s = sum(l)
	if s % k:
		print('No')
		return 0
	q = s / k
	m = [0 for i in range(k)]
	c_m = 0
	c_s = 0
	for i in range(n):
		if c_s + l[i] < q:
			m[c_m] += 1
			c_s += l[i]
		elif c_s + l[i] == q:
			m[c_m] += 1
			c_s += l[i]
			c_s = 0
			c_m += 1
		else:
			print('No')
			return 0
	print('Yes')
	print(*m)
main()


import sys
import math
import bisect

def solve(A, m):
	n = len(A)
	total = sum(A)
	if total % m:
		return None
	B = []
	val = 0
	cnt = 0
	for i in range(n):
		val += A[i]
		cnt += 1
		if val == total // m:
			B.append(cnt)
			val = 0
			cnt = 0
		elif val > total // m:
			return None
	return B

def main():
	(n, m) = map(int, input().split())
	A = list(map(int, input().split()))
	ans = solve(A, m)
	if ans:
		print('Yes')
		print(' '.join(list((str(a) for a in ans))))
	else:
		print('No')
main()


(n, k) = input().split()
(n, k) = (int(n), int(k))
V = [int(s) for s in input().split()]
sumV = sum(V)
S = []
count = 0
currentLength = 0
possible = sumV % k == 0
target = sumV // k
for v in V:
	count += 1
	currentLength += v
	if currentLength == target:
		S.append(count)
		count = 0
		currentLength = 0
	elif currentLength > target:
		possible = False
		break
if possible:
	print('Yes')
	for s in S:
		print(s, end=' ')
else:
	print('No')


import sys
(n, k) = tuple((int(i) for i in sys.stdin.readline().split()))
a = tuple((int(i) for i in sys.stdin.readline().split()))
assert len(a) == n

def solve(n, k, a):
	(q, r) = divmod(sum(a), k)
	if r > 0:
		return
	s = []
	i = 0
	while i < n:
		total = 0
		count = 0
		while i < n:
			total += a[i]
			count += 1
			i += 1
			if total == q:
				break
			if total > q:
				return
		s.append(count)
	return s
r = solve(n, k, a)
if r is None:
	print('No')
else:
	print('Yes')
	print(' '.join((str(i) for i in r)))