#include <bits/stdc++.h>   using namespace std;   int main() {     long long int n, k;     cin >> n >> k;     long long int res = 1;     if (k == 1) {       cout << n;     } else {       while (res <= n) res = (long long)(res * 2);       cout << res - 1;     }     return 0;   }   