#include <bits/stdc++.h>

using namespace std;

int main() {
  int n, m;

  while (cin >> n >> m, n != 0) {
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }

    int ans = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] < m / n) {
        ans += a[i];
      } else {
        ans += m / n;
      }
    }
    cout << ans << "\n";
  }

  return 0;
}
