#include #include #include #include using namespace std; using ll = long long; using P = pair; int main(void){ int n, m; cin >> n >> m; priority_queue, greater

> pri; for(int i=0; i> t; auto [nt, id]=pri.top(); pri.pop(); pri.emplace(nt+t, id); } ll ans=0; while(pri.size()){ ans=max(ans, pri.top().first); pri.pop(); } cout << ans << endl; return 0; }