#include<bits/stdc++.h>
using namespace std;

int main()
{
  int64_t n,x,z;
  double y=0;
  x=0;
  cin>>n;
  vector<int64_t> a(n);
  for(int i=0;i<n;i++)
  {
    cin>>a.at(i);
    if(a.at(i)<0)
      a.at(i)*=-1;
    x+=a.at(i);
    y+=(a.at(i)*a.at(i));
  }
  y=sqrt(y);
  sort(a.begin(),a.end());
  z=a.at(n-1);
  cout<<x<<endl;
  cout<<fixed<<setprecision(10);
  cout<<y<<endl;
  cout<<z<<endl;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair <int, int> pin;

const int N = 45;
const int S = (1 << 20) + 5;
const ll inf = 1LL << 60;

int n;
ll m, a[N];
vector <ll> sa, sb;

template <typename T>
inline void read(T &X) {
    char ch = 0; T op = 1; 
    for (X = 0; ch > '9' || ch < '0'; ch = getchar())
        if (ch == '-') op = -1;
    for (; ch >= '0' && ch <= '9'; ch = getchar())
        X = (X * 10) + ch - '0';
    X *= op;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("sample.in", "r", stdin);
#endif

    read(n), read(m);
    for (int i = 1; i <= n; i++) read(a[i]);
    int l = n / 2, r = n - l;
    for (int s = 0; s < (1 << l); ++s) {
        ll now = 0;
        for (int i = 0; i < l; i++)
            if (s & (1 << i)) now += a[i + 1];
        sa.push_back(now);
    }
    for (int s = 0; s < (1 << r); ++s) {
        ll now = 0;
        for (int i = 0; i < r; i++)
            if (s & (1 << i)) now += a[l + i + 1];
        sb.push_back(now);
    }
    sort(sb.begin(), sb.end());

    // for (int i = 0; i < sa.size(); i++)
    //     printf("%lld%c", sa[i], " \n"[i == sa.size() - 1]);
    // for (int i = 0; i < sb.size(); i++)
    //     printf("%lld%c", sb[i], " \n"[i == sb.size() - 1]);

    ll ans = m;
    for (int i = 0; i < sa.size(); i++) {
        ll ta = sa[i];
        if (ta > m) continue;
        if (ta == m) {
            ans = 0;
            break;
        }
        int tb = upper_bound(sb.begin(), sb.end(), m - ta) - sb.begin() - 1;
        ll tmpb;
        if (tb < 0) tmpb = 0;
        else tmpb = sb[tb];
        if (tmpb + ta <= m) ans = min(ans, m - tmpb - ta);
    }
    printf("%lld\n", m - ans);
    return 0;
}