#include <bits/stdc++.h>
using namespace std;
long long c[32ll + 1];
long long dp[32ll + 1];
long long l;
long long solve(long long n) {
  if (n < 0) {
    return 0;
  }
  if (dp[n] != -1) {
    return dp[n];
  }
  if ((1ll << n) & l) {
    return dp[n] = min(solve(n - 1) + c[n], 2 * c[n]);
  }
  return dp[n] = min(solve(n - 1), c[n]);
}
int main() {
  long long i;
  int n;
  memset(c, 0x3f, sizeof(c));
  scanf("%d%lld", &n, &l);
  for (i = 0; i < n; i++) {
    scanf("%lld", c + i);
  }
  for (i = 1; i <= 32ll; i++) {
    if (c[i] > 2 * c[i - 1]) {
      c[i] = 2 * c[i - 1];
    }
  }
  memset(dp, -1, sizeof(dp));
  printf("%lld\n", solve(32ll));
  return 0;
}
