#include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef long double ld; #define PI (ld)3.14159265358979324 #define mp make_pair #define pb push_back #define ft first // #define sd second #define sz(a) (ll)a.size() #define pii pair #define pll pair #define loop(i, n) for(int (i) = 0; (i) < (n) ; ++ (i)) #define forn(i, l, r) for(int (i) = (l); (i) < (r) ; ++ (i)) #define vec vector #define str string /*******************************************************/ int n,k; vec c; ll check(int k0) { ll ans = c[k0]; int p = k0 + 2ll * k + 1; int rb = k0 + k; while(p < n) { ans += c[p]; rb = p + k; p += 2ll * k + 1; } if(rb >= n - 1) return ans; return 1e15; } void solve() { cin >> n >> k; c.resize(n); loop(i,n) cin >> c[i]; if(k >= n - 1) { ll ans = c[0]; loop(i,n) ans = min(ans,c[i]); cout <