CF1070K.Video Posts

传统题 时间 2000 ms 内存 256 MiB 5 尝试 1 已通过 1 标签

Video Posts

Polycarp took nn videos, the duration of the ii-th video is aia_i seconds. The videos are listed in the chronological order, i.e. the 11-st video is the earliest, the 22-nd video is the next, ..., the nn-th video is the last.

Now Polycarp wants to publish exactly kk (1kn1 \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 jj-th post is sjs_j then:

  • s1+s2++sk=ns_1+s_2+\dots+s_k=n (si>0s_i \gt 0),
  • the first post contains the videos: 1,2,,s11, 2, \dots, s_1;
  • the second post contains the videos: s1+1,s1+2,,s1+s2s_1+1, s_1+2, \dots, s_1+s_2;
  • the third post contains the videos: s1+s2+1,s1+s2+2,,s1+s2+s3s_1+s_2+1, s_1+s_2+2, \dots, s_1+s_2+s_3;
  • ...
  • the kk-th post contains videos: nsk+1,nsk+2,,nn-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 s1,s2,,sks_1, s_2, \dots, s_k that satisfy all the conditions above.

Input

The first line contains two integers nn and kk (1kn1051 \le k \le n \le 10^5). The next line contains nn positive integer numbers a1,a2,,ana_1, a_2, \dots, a_n (1ai1041 \le a_i \le 10^4), where aia_i is the duration of the ii-th video.

Output

If solution exists, print "Yes" in the first line. Print kk positive integers s1,s2,,sks_1, s_2, \dots, s_k (s1+s2++sk=ns_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".

Samples

6 3
3 3 1 4 1 6
Yes
2 3 1 
3 3
1 1 1
Yes
1 1 1 
3 3
1 1 2
No
3 1
1 10 100
Yes
3 

在线编程 IDE

建议全屏模式获得最佳体验