#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


int N,M;

void func(){

	int ans = 0;

	int A,pay = M/N;

	for(int i = 0; i < N; i++){

		scanf("%d",&A);

		ans += min(A,pay);
	}

	printf("%d\n",ans);

}

int main(){

	while(true){

		scanf("%d %d",&N,&M);

		if(N == 0 && M == 0){
			break;
		}

		func();
	}

	return 0;
}

