Since Grisha behaved well last year, at New Year's Eve he was visited by Ded Moroz who brought an enormous bag of gifts with him! The bag contains n sweet candies from the good ol' bakery, each labeled from 1 to n corresponding to its tastiness. No two candies have the same tastiness.

The choice of candies has a direct effect on Grisha's happiness. One can assume that he should take the tastiest ones — but no, the holiday magic turns things upside down. It is the xor-sum of tastinesses that matters, not the ordinary sum!

A xor-sum of a sequence of integers a1, a2, ..., am is defined as the bitwise XOR of all its elements: <image>, here <image> denotes the bitwise XOR operation; more about bitwise XOR can be found [here.](https://en.wikipedia.org/wiki/Bitwise_operation#XOR)

Ded Moroz warned Grisha he has more houses to visit, so Grisha can take no more than k candies from the bag. Help Grisha determine the largest xor-sum (largest xor-sum means maximum happiness!) he can obtain.

Input

The sole string contains two integers n and k (1 ≤ k ≤ n ≤ 1018).

Output

Output one number — the largest possible xor-sum.

Examples

Input

4 3


Output

7


Input

6 6


Output

7

Note

In the first sample case, one optimal answer is 1, 2 and 4, giving the xor-sum of 7.

In the second sample case, one can, for example, take all six candies and obtain the xor-sum of 7.
#include <bits/stdc++.h>
using namespace std;
long long int binarySearch(vector<long long int> v, long long int l,
                           long long int r, long long int x) {
  if (r >= l) {
    long long int mid = l + (r - l) / 2;
    if (v[mid] == x) return mid;
    if (v[mid] > x) return binarySearch(v, l, mid - 1, x);
    return binarySearch(v, mid + 1, r, x);
  }
  return -1;
}
void commonElementsVect(vector<long long int> v1, long long int n,
                        vector<long long int> v2, long long int m) {
  unordered_set<long long int> s;
  for (long long int i = 0; i < n; i++) s.insert(v1[i]);
  for (long long int i = 0; i < m; i++) {
    if (s.find(v2[i]) != s.end()) printf("%lld\n", v2[i]);
  }
}
void findPermutations(vector<long long int> v, long long int n) {
  sort(v.begin(), v.end());
  do {
    for (long long int i = 0; i < n; i++) cout << v[i] << "  ";
    "\n";
  } while (next_permutation(v.begin(), v.end()));
}
long long int maxSubArraySum(vector<long long int> v, long long int n) {
  long long int sum = v[0], curr = v[0];
  for (long long int i = 0; i < n; i++) sum = max(sum, max(v[i], curr + v[i]));
  return sum;
}
void printResult(vector<long long int>& ans) {
  for (auto& it : ans) cout << it << ' ';
}
void allPossibleSubset(vector<long long int> v, long long int n) {
  long long int count = pow(2, n);
  for (int i = 0; i < count; i++) {
    for (int j = 0; j < n; j++)
      if ((i & (1 << j)) > 0) cout << v[j] << " ";
    cout << "\n";
  }
}
long long int fib(long long int n) {
  return round(pow((1 + sqrt(5)) / 2, n) / sqrt(5));
}
long long int sumFib(long long int l, long long int r) {
  long long int sum = 0;
  for (long long int i = l; i <= r; i++) sum += fib(i);
  return sum;
}
long long int factorial(long long int n) {
  return (n == 1 || n == 0) ? 1 : n * factorial(n - 1);
}
vector<long long int> slicing(vector<long long int>& arr, long long int x,
                              long long int y) {
  vector<long long int> result(y - x + 1);
  copy(arr.begin() + y, arr.begin() + y + 1, result.begin());
  return result;
}
long long int factor[1000001] = {0};
void generatePrimeFactors() {
  factor[1] = 1;
  for (long long int i = 2; i < 1000001; i++) factor[i] = i;
  for (long long int i = 4; i < 1000001; i++) {
    factor[i] = 2;
    i += 1;
  }
  for (long long int i = 3; i * i < 1000001; i++) {
    if (factor[i] == i) {
      for (long long int j = i * i; j < 1000001; j += i) {
        if (factor[j] == j) factor[j] = i;
      }
    }
  }
}
long long int calculateNoOFactors(long long int n) {
  generatePrimeFactors();
  if (n == 1) return 1;
  long long int ans = 1, dup = factor[n], c = 1, j = n / factor[n];
  while (j != 1) {
    if (factor[j] == dup)
      c += 1;
    else {
      dup = factor[j];
      ans = ans * (c + 1);
      c = 1;
    }
    j = j / factor[j];
  }
  ans = ans * (c + 1);
  return ans;
}
long long int sumofFactors(long long int n) {
  int res = 1;
  for (int i = 2; i <= sqrt(n); i++) {
    int curr_sum = 1;
    int curr_term = 1;
    while (n % i == 0) {
      n = n / i;
      curr_term *= i;
      curr_sum += curr_term;
    }
    res *= curr_sum;
  }
  if (n >= 2) res *= (1 + n);
  return res;
}
long long int power(long long int x, long long int y) {
  long long int res = 1;
  while (y > 0) {
    if (y & 1) res = (res * x) % 1000000007;
    y = (y >> 1) % 1000000007;
    x = (x * x) % 1000000007;
  }
  return res;
}
void primeFactors(long long int n) {
  while (n % 2 == 0) {
    cout << 2 << " ";
    n = n / 2;
  }
  for (int i = 3; i <= sqrt(n); i = i + 2) {
    while (n % i == 0) {
      cout << i << " ";
      n = n / i;
    }
  }
  if (n > 2) cout << n << " ";
}
long long int countFactors(long long int n) {
  long long int count = 0;
  for (long long int i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      if (n / i == i)
        count++;
      else
        count += 2;
    }
  }
  return count;
}
long long int multiplyFactors(long long int n) {
  long long int numFactor = countFactors(n);
  long long int product = power(n, numFactor / 2);
  if (numFactor & 1) product = (product * (long long int)sqrt(n)) % 1000000007;
  return product;
}
void primeNumbersTillN(long long int n) {
  bool prime[n + 1];
  memset(prime, true, sizeof(prime));
  for (int p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (int i = p * 2; i <= n; i += p) prime[i] = false;
    }
  }
  for (int p = 2; p <= n; p++)
    if (prime[p]) cout << p << " ";
}
bool prime(long long int n) {
  if (n < 2) return false;
  for (int x = 2; x * x <= n; x++) {
    if (n % x == 0) return false;
  }
  return true;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long int xPowNModm(long long int x, long long int n, long long int m) {
  if (n == 0) return 1 % m;
  long long int u = xPowNModm(x, n / 2, m);
  u = (u * u) % m;
  if (n % 2 == 1) u = (u * x) % m;
  return u;
}
long long int count_Prime_Factors(long long int n) {
  long long int count = 0;
  for (long long int i = 2; i <= n / 2; i++) {
    if (prime(i)) {
      if (n % i == 0) count++;
    }
  }
  return count;
}
long long int findlcmOfVec(vector<long long int> v, long long int n) {
  long long int ans = v[0];
  for (long long int i = 0; i < n; i++)
    ans = (((v[i] * ans)) / (gcd(v[i], ans)));
  return ans;
}
bool isPower(long double x, long double y) {
  double res = log10(y) / log10(x);
  return (res == floor(res));
}
void bin(long long int n) {
  unsigned i;
  for (i = 1 << 31; i > 0; i = i / 2) (n & i) ? printf("1") : printf("0");
}
void Solve() {
  long long int n, k, i;
  cin >> n >> k;
  for (i = 1; i <= n; i *= 2) {
  }
  cout << (k == 1 ? n : i - 1);
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  Solve();
  return 0;
}
