#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, k;
  cin >> k >> n;
  vector<int> a(n * k + 1);
  for (int i = 1; i <= n * k; i++) {
    cin >> a[i];
  }
  long long x = k - ((k + 1) / 2 - 1);
  long long z = n * k + 1;
  long long ans = 0;
  while (n--) {
    z -= x;
    if (z <= 0) break;
    ans += a[z];
  }
  cout << ans << endl;
}
signed main() {
  int t = 1;
  cin >> t;
  while (t--) solve();
}
