#include <bits/stdc++.h>
using namespace std;
inline char nc() {
  static char buf[100000], *p1 = buf, *p2 = buf;
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
template <typename T = int>
inline T nxt() {
  char c = nc();
  T x = 0;
  int f = 1;
  for (; c > '9' || c < '0'; c = nc())
    if (c == '-') f = -1;
  for (; c >= '0' && c <= '9'; x = x * 10 + c - '0', c = nc())
    ;
  x *= f;
  return x;
}
const int N = 31;
long long cost[N];
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  int n = nxt(), l = nxt();
  for (int i = 0; i < (n); ++i) cost[i] = nxt();
  for (int i = 1; i < (n); ++i) cost[i] = min(2 * cost[i - 1], cost[i]);
  for (int i = n; i < (N); ++i) cost[i] = 2 * cost[i - 1];
  long long ans = 0;
  for (int i = 0; i < (N); ++i) {
    if (1LL * l & (1LL << i))
      ans += cost[i];
    else
      ans = min(cost[i], ans);
  }
  cout << ans << '\n';
}
