#include
int main()
{
int i,j=0,n,m,t=0,time=0,c[100000]={0};
scanf("%d %d",&n,&m);
for(i=0;i

#include <stdio.h>
int main() {
int i, j, n, m;
int t = 0; // 总时间
int min_index; // 当前结账时间最短的顾客索引
// 读取输入
scanf("%d %d", &n, &m);
int items[n]; // 每位顾客的商品数量
int times[m]; // 每件商品的扫描时间
int customer_times[n]; // 每位顾客的结账时间
// 初始化每位顾客的商品数量
for (i = 0; i < n; i++) {
items[i] = 0;
customer_times[i] = 0;
}
// 读取每件商品的扫描时间
for (i = 0; i < m; i++) {
scanf("%d", ×[i]);
}
// 逐个分配商品扫描时间给顾客
for (i = 0; i < m; i++) {
min_index = 0;
// 找到当前结账时间最短的顾客
for (j = 1; j < n; j++) {
if (customer_times[j] < customer_times[min_index]) {
min_index = j;
}
}
// 将当前商品的扫描时间加到该顾客的总结账时间上
customer_times[min_index] += times[i];
}
// 找到所有顾客中结账时间最长的那个时间
for (i = 0; i < n; i++) {
if (customer_times[i] > t) {
t = customer_times[i];
}
}
// 输出结果
printf("%d\n", t);
return 0;
}