#include <bits/stdc++.h>
int main() {
  long long kind[32], buy, money, anwser = 0, n;
  int i;
  scanf("%lld", &n);
  scanf("%lld", &buy);
  for (i = 0; i < n; i++) scanf("%lld", &kind[i]);
  for (i = 1; i < n; i++)
    if (kind[i] > 2 * kind[i - 1]) kind[i] = 2 * kind[i - 1];
  for (i = 0; i < n; i++) {
    if (anwser > kind[i]) anwser = kind[i];
    if (buy % 2 == 1) anwser += kind[i];
    buy = buy / 2;
  }
  buy *= 2;
  anwser += buy * kind[n - 1];
  printf("%lld\n", anwser);
}
