#include <bits/stdc++.h>
using namespace std;

//#define DEBUG_MODE

#ifdef DEBUG_MODE
#define DEBUG(X) debug_func(X, #X)
#define DEBUG_SEPARATOR_LINE cout<<"=================\n"
#else
#define DEBUG(X) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

#define ALL(V) (V).begin(), (V).end()
#define DEBUG_ENDL(S) ((S).size() ? "\n" : "")

template <typename T> using V = vector<T>;
template <typename T> using VV = vector<V<T>>;
template <typename T, typename U> using P = pair<T, U>;
using ll = int64_t;
using PLL = P<ll, ll>;

void debug_func_preffix(const string &s) { if(s.size()) cout << s << " = "; }

template <typename T>
void debug_func(const T &t, const string &s = "") {
    debug_func_preffix(s);
    cout << t << DEBUG_ENDL(s);
}

template <typename T, typename U>
void debug_func(const P<T, U> &p, const string &s = "") {
    debug_func_preffix(s);
    cout << "(";
    debug_func(p.first);
    cout << ", ";
    debug_func(p.second);
    cout << ")" << DEBUG_ENDL(s);
}

template <typename T>
void debug_func(const V<T> &v, const string &s = "") {
    for(ll i = 0; i < v.size(); i++) {
        string t = s + "[" + to_string(i) + "]";
        debug_func(v[i], t);
    }
}

const ll INF = 5e15;
ll N, K;
ll minv = INF, minv2 = INF;
ll minvi, minv2i;
ll sum = 0;

bool check1(V<PLL> A) {
    ll loops = minv;
    ll to_change = loops + loops / N;
    DEBUG(loops);
    DEBUG(to_change);
    if(to_change < K || (to_change == K && minv == minv2)) return 0;
    sort(ALL(A));
    reverse(ALL(A));
    V<ll> output;
    ll cnt = 0;
    cout << sum << endl;
    while(cnt < sum) {
        for(ll i = 0; i < N; i++) {
            if(A[i].first > 0) {
                cout << A[i].second << " \n"[cnt + 1 == sum];
                A[i].first--;
                cnt++;
            }
        }
    }
    return 1;
}

bool check2(V<PLL> A) {
    ll idx = minvi;
    V<ll> output;
    ll cnt = 0;
    for(ll i = 0; i < N; i++) {
        if(i != idx) {
            output.push_back(A[i].second);
            A[i].first--;
        }
    }
    output.push_back(A[idx].second);
    A[idx].first--;
    cnt++;
    while(1) {
        ll mv = INF, mi;
        for(ll i = 0; i < N; i++) {
            if(i == idx) continue;
            if(A[i].first == 0) return 0;
            if(mv > A[i].first) {
                mv = A[i].first;
                mi = i;
            }
        }
        for(ll i = 0; i < N; i++) {
            if(i == idx || i == mi) continue;
            output.push_back(A[i].second);
            A[i].first--;
        }
        output.push_back(A[mi].second);
        A[mi].first--;
        cnt++;
        if(cnt == K + 1) break;
        idx = mi;
    }
    cout << output.size() << endl;
    for(ll i = 0; i < output.size(); i++) cout << output[i] << " \n"[i + 1 == output.size()];
    return 1;
}

int main() {
    cin >> N >> K;
    V<PLL> A;
    for(ll i = 0; i < N; i++) {
        ll a;
        cin >> a;
        A.emplace_back(a, i + 1);
        sum += a;
        if(minv > a) {
            minv2i = minvi;
            minv2 = minv;
            minv = a;
            minvi = i;
        } else if(minv2 > a) {
            minv2i = i;
            minv2 = a;
        }
    }
//    if(check1(A)) return 0;
    if(check2(A)) return 0;
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 256