#include <bits/stdc++.h>
using namespace std;
inline void ReadInt(int &num) {
  num = 0;
  int f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    num = num * 10 + (c - '0');
    c = getchar();
  }
  num = num * f;
  return;
}
inline void ReadLong(long long &num) {
  num = 0;
  int f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    num = num * 10 + (c - '0');
    c = getchar();
  }
  num = num * f;
  return;
}
int n, l;
int v[32], c[32], p[32];
long long dfs(int cur) {
  if (!cur) return 0;
  int i, j;
  long long mn = 1e18;
  for (i = 0; i < n && v[i] <= cur; i++)
    ;
  i--;
  for (j = i + 1; j < n; j++) mn = min(mn, (long long)c[j]);
  return min(mn, (long long)cur / v[p[i]] * c[p[i]] + dfs(cur % v[p[i]]));
}
int main() {
  int cnt = 1;
  cin >> n >> l;
  for (int i = 0; i < n; i++) {
    cnt *= 2;
    v[i] = cnt / 2;
    cin >> c[i];
    if (!i)
      p[i] = i;
    else if (c[p[i - 1]] * (v[i - p[i - 1]]) < c[i])
      p[i] = p[i - 1];
    else
      p[i] = i;
  }
  cout << dfs(l) << endl;
  return 0;
}
