#include <bits/stdc++.h>   using namespace std;   template <typename T>   void read(T &a) {     T x = 0, f = 1;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       x = (x << 1) + (x << 3) + (ch ^ 48);       ch = getchar();     }     a = x * f;   }   template <typename T, typename... Args>   void read(T &t, Args &...args) {     read(t);     read(args...);   }   long long n, k, a[100005];   struct node {     long long len, k;     bool operator<(const node &x) const {       long long tmp1 = (len / k) * (len / k) * (k - len % k) +                        (len / k + 1) * (len / k + 1) * (len % k);       long long tmp2 = (x.len / x.k) * (x.len / x.k) * (x.k - x.len % x.k) +                        (x.len / x.k + 1) * (x.len / x.k + 1) * (x.len % x.k);       long long kk = k + 1;       long long tmpp1 = (len / kk) * (len / kk) * (kk - len % kk) +                         (len / kk + 1) * (len / kk + 1) * (len % kk);       kk = x.k + 1;       long long tmpp2 = (x.len / kk) * (x.len / kk) * (kk - x.len % kk) +                         (x.len / kk + 1) * (x.len / kk + 1) * (x.len % kk);       tmp1 -= tmpp1;       tmp2 -= tmpp2;       if (k == len) tmp1 = 0;       if (x.k == x.len) tmp2 = 0;       return tmp1 < tmp2;     }   };   priority_queue<node> q;   void update(long long &ans, node &x) {     ans -= (x.len / x.k) * (x.len / x.k) * (x.k - x.len % x.k) +            (x.len / x.k + 1) * (x.len / x.k + 1) * (x.len % x.k);     x.k++;     ans += (x.len / x.k) * (x.len / x.k) * (x.k - x.len % x.k) +            (x.len / x.k + 1) * (x.len / x.k + 1) * (x.len % x.k);   }   signed main() {     read(n, k);     long long ans = 0;     for (long long i = 1; i <= n; i++) {       read(a[i]);       node tmp;       tmp.len = a[i];       tmp.k = 1;       q.push(tmp);     }     for (long long i = 1; i <= n; i++) ans += a[i] * a[i];     k -= n;     while (k) {       k += 19260817;       node x = q.top();       q.pop();       update(ans, x);       q.push(x);       k -= 19260818;     }     printf( %lld n , ans +  O  -  O );     return 0;   }   