#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 1;
int a[N];
size_t t, n, m;
int main(int argc, char** argv) {
  cin >> t;
  for (size_t i = 0; i < t; i++) {
    cin >> n >> m;
    double s = 0;
    for (size_t j = 0; j < n; j++) {
      cin >> a[j];
      s += a[j];
    }
    double avg = s / n;
    double ans = avg * n;
    if (ans > m) {
      cout << m << endl;
    } else {
      cout << ans << endl;
    }
  }
  return 0;
}
