#include <bits/stdc++.h>
using namespace std;
long long len, sum;
long long num[35];
long long dfs(long long has, long long val, int ind, int nee) {
  if ((has + (1 << ind + 1)) < nee) return (long long)1e18;
  if (has >= nee) return val;
  if (ind == -1) {
    if (has >= nee) return val;
    return (long long)1e18;
  }
  return min(dfs(has + (1 << ind), val + num[ind], ind - 1, nee),
             dfs(has, val, ind - 1, nee));
}
int main() {
  scanf("%lld%lld", &len, &sum);
  for (int i = 0; i < len; i++) {
    scanf("%lld", &num[i]);
  }
  long long now = num[0];
  for (int i = 1; i < len; i++) {
    now <<= 1;
    if (now < num[i])
      num[i] = now;
    else
      now = num[i];
  }
  long long sum2 = sum;
  long long xxx = sum / (1 << (len - 1)) - 1;
  long long ans = 0;
  if (xxx > 0) {
    ans += xxx * num[len - 1];
    sum -= xxx * (1 << (len - 1));
  }
  ans += dfs(0, 0, len - 1, sum);
  long long xxx2 = sum2 / (1 << (len - 1));
  long long ans2 = 0;
  if (xxx2 > 0) {
    ans2 += xxx2 * num[len - 1];
    sum2 -= xxx2 * (1 << (len - 1));
  }
  ans2 += dfs(0, 0, len - 1, sum2);
  printf("%lld\n", min(ans, ans2));
  return 0;
}
