#include <bits/stdc++.h>
using namespace std;
const long long N = 40;
long long n, l, a[N], dp[N];
signed main() {
  scanf("%lld%lld", &n, &l);
  for (long long i = 0; i <= 31; i++) dp[i] = 1e18;
  for (long long i = 0; i < n; i++) scanf("%lld", &a[i]), dp[i] = a[i];
  for (long long i = 1; i <= 31; i++)
    for (long long j = 0; j < i; j++)
      dp[i] = min(dp[i], dp[j] * (1ll << (i - j)));
  long long ans = 0;
  for (long long i = 0; i <= 31; i++)
    if ((l >> i) & 1ll) ans += dp[i];
  for (long long i = 0; i <= 31; i++) {
    if ((l >> i) & 1ll) continue;
    long long cnt = 0;
    for (long long j = 31; j > i; j--)
      if ((l >> j) & 1ll) cnt += dp[j];
    ans = min(ans, cnt + dp[i]);
  }
  printf("%lld\n", ans);
}
