#include <bits/stdc++.h>   using namespace std;   int main() {     int n, l;     cin >> n >> l;     vector<int> v = vector<int>(n);     for (int i = 0; i < n; i++) cin >> v[i];     sort(v.begin(), v.end());     int vals = 1;     int prev = v[0];     vector<pair<int, int>> vp;     vp.push_back(make_pair(prev, 1));     for (int i = 1; i < n; i++) {       if (v[i] == prev) {         vp[vp.size() - 1].second++;       } else {         prev = v[i];         vp.push_back(make_pair(prev, 1));         vals++;       }     }     double t = log2(vals);     int fs = t;     if (t > fs) fs++;     if (fs * n < l * 8) {       cout << 0 << endl;       return 0;     }     int max_log = (l * 8) / n;     int distinct = 1 << max_log;     int start_p = 0;     int end_p = vp.size() - 1;     vector<int> ps = vector<int>(vp.size() + 1, 0);     ps[0] = 0;     for (int i = 0; i < vp.size(); i++) ps[i + 1] = ps[i] + vp[i].second;     vector<int> ss = vector<int>(vp.size() + 1, 0);     ss[0] = 0;     for (int i = 0; i < vp.size(); i++) {       ss[i + 1] = ss[i] + vp[vp.size() - 1 - i].second;     }     int mn = n;     for (int i = 0; i < vals - distinct; i++) {       if (ps[i] + ss[vals - distinct - i] < mn)         mn = ps[i] + ss[vals - distinct - i];     }     cout << mn << endl;     return 0;   }   