#include <bits/stdc++.h>
using namespace std;
using ll = int;
int main()
{
    ll n, k, ans;
    cin >> n >> k;
    vector<ll> v(n, 0);
    for(ll i = 0; i < n; i++)cin >> v[i];
    ans = v[0];
    for(ll i = 1; i < n; i++)ans = ans|v[i];
    cout << ans;
    return 0;
}
