#include using namespace std; using ll = long long; int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); ll N, X, S=0, r=0, mx=0, cnt=0; cin >> N >> X; vector A(N); for (int i=0; i> A[i]; S += A[i]; } if (S <= X){ cout << S << endl; return 0; } S = 0; for (int l=0; l