func_code_string: #include <bits/stdc++.h>   using namespace std;   long long powmod(long long a, long long b) {     long long res = 1;     a %= 1000000007;     for (; b; b >>= 1) {       if (b & 1) res = res * a % 1000000007;       a = a * a % 1000000007;     }     return res;   }   template <typename T>   inline bool chkmin(T &a, const T &b) {     return a > b ? a = b, 1 : 0;   }   template <typename T>   inline bool chkmax(T &a, const T &b) {     return a < b ? a = b, 1 : 0;   }   int read() {     int 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 * 10 + ch -  0 ;       ch = getchar();     }     return x * f;   }   int a[100005], n;   const int mx = 30;   long long m;   struct trie_node {     int num[30], siz, ch[2];   } t[100005 * 20];   const int head = 1;   int tot = 1;   void insert(int x) {     int p = head;     for (int i = mx - 1; i >= 0; i--) {       int bit = x >> i & 1;       if (!t[p].ch[bit]) t[p].ch[bit] = ++tot;       p = t[p].ch[bit];       for (int i = 0; i < mx; i++) t[p].num[i] += x >> i & 1;       t[p].siz++;     }   }   int now[100005];   int num[30], all[30];   int main() {     scanf( %d%lld , &n, &m);     m <<= 1;     for (int i = 1; i <= n; i++) scanf( %d , &a[i]), insert(a[i]);     for (int i = 1; i <= n; i++) now[i] = head;     memset(num, 0, sizeof num);     for (int i = mx - 1; i >= 0; i--) {       long long tmp = 0;       for (int j = 1; j <= n; j++) tmp += t[t[now[j]].ch[!(a[j] >> i & 1)]].siz;       if (tmp <= m) {         for (int j = 1; j <= n; j++) {           for (int k = mx - 1; k >= 0; k--) {             if (a[j] >> k & 1)               num[k] += t[t[now[j]].ch[!(a[j] >> i & 1)]].siz -                         t[t[now[j]].ch[!(a[j] >> i & 1)]].num[k];             else               num[k] += t[t[now[j]].ch[!(a[j] >> i & 1)]].num[k];           }           now[j] = t[now[j]].ch[a[j] >> i & 1];         }         m -= tmp;       } else {         for (int j = 1; j <= n; j++)           now[j] = t[now[j]].ch[!(a[j] >> i & 1)], all[i] = 1;       }     }     for (int i = 0; i < mx; i++) num[i] += all[i] * m;     long long ans = 0;     for (int i = 0; i < mx; i++) {       ans += (1LL << i) * (num[i] / 2);     }     ans %= 1000000007;     printf( %lld n , ans);     return 0;   }   