#include using namespace std; #define FOR(a, b, c) for(int a = (b); a < (c); a++) #define PB push_back using ll = long long; #define LL long long const int MAX = 2e5+7; vector arr; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, k; cin >> n >> k; arr.resize(n); FOR(i, 0, n) { cin >> arr[i]; } int res = 0; for(int i = 30; i >= 0; --i) { vector temp; FOR(j, 0, arr.size()) { if(arr[j] & (1 << i)) { temp.PB(arr[j]); } } if(temp.size() >= k) { res |= (1 << i); arr = temp; } } cout << res; }