#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define MAX_N 510 #define PI 3.141592653589 #define ESP 1e-20 #define BS 10 #define MOD 1000000007 #define ZERO 10001 #define YJSNPI 810 #define INF (1LL << 50) #define ADD(a, b) a = (a + (ll)b) % MOD #define MUL(a, b) a = (a * (ll)b) % MOD #define MAX(a, b) a = max(a, b) #define MIN(a, b) a = min(a, b) using namespace std; typedef long long ll; typedef pair pi; int N; ll M; ll sum[110]; int main() { scanf("%d%d", &N, &M); for(int i = 0; i < N; i++) { scanf("%d", &sum[i + 1]); sum[i + 1] += sum[i]; } M -= N; if(M <= 0) { cout << sum[N] << endl; return 0; } ll res = INF; for(int i = 1; i <= N; i++) { res = min(res, (M / i) * sum[i] + sum[M % i]); } cout << res + sum[N] << endl; }