#include <bits/stdc++.h>
using namespace std;
int xm[4] = {-1, 1, 0, 0};
int ym[4] = {0, 0, -1, 1};
const int MOD = 1e9 + 7;
const int MAXN = 5e5 + 5;
const long long POW = 9973;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n, k;
  cin >> n >> k;
  long long l = 1;
  long long r = n;
  long long ans = 1;
  while (l <= r) {
    long long m = l + (r - l) / 2;
    long long res = 0;
    for (long long st = m; st <= m + 1; st++) {
      if (st <= 0 || st > n) continue;
      long long cnt = 0;
      long long cur = st;
      long long top = st;
      while (cur <= n) {
        if (top % 2 == 0) top++;
        cnt += min(n, top) - cur + 1;
        cur *= 2;
        top *= 2;
      }
      if (cnt >= k) res = st;
    }
    if (res != 0) {
      ans = max(ans, res);
      l = res + 1;
    } else
      r = m - 1;
  }
  cout << ans;
}
