#pragma GCC optimize("O3")
#pragma GCC target ("sse4")
#include<bits/stdc++.h>
#include <random>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace chrono;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds; // find_by_order, order_of_key
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; // find_by_order, order_of_key less_equal
#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x <<" "; _print(x); cerr << endl;
#else
#define debug(x)
#endif
typedef long long ll;
typedef unsigned long long ull;
typedef long double lld;
void _print(ll t) {cerr << t;}
void _print(int t) {cerr << t;}
void _print(string t) {cerr << t;}
void _print(char t) {cerr << t;}
void _print(lld t) {cerr << t;}
void _print(double t) {cerr << t;}
void _print(ull t) {cerr << t;}
template <class T, class V> void _print(pair <T, V> p);
template <class T> void _print(vector <T> v);
template <class T> void _print(set <T> v);
template <class T, class V> void _print(map <T, V> v);
template <class T> void _print(multiset <T> v);
template <class T, class V> void _print(pair <T, V> p) {cerr << "{"; _print(p.first); cerr << ","; _print(p.second); cerr << "}";}
template <class T> void _print(vector <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(set <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(multiset <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T, class V> void _print(map <T, V> v) {cerr << "[ "; for (auto i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(stack <T> st) { cerr << "[ "; while (!st.empty()) { (st.empty() ? (void)0 : (_print(st.top()), cerr << " ", st.pop())); } cerr << "]"; }
template <class T> void _print(priority_queue<T> pq) {cerr << "[ "; while (!pq.empty()) { _print(pq.top()); cerr << " "; pq.pop(); } cerr << "]";}
template <class T> void _print(priority_queue<T, vector<T>, greater<T>> pq) {cerr << "[ "; while (!pq.empty()) { _print(pq.top()); cerr << " "; pq.pop(); } cerr << "]"; }
#define MOD 32768
#define int long long
#define rep(i, a, b) for (int i = a; i < b; i++)
int dp[40000][17];
const int mod = 1e9 + 7;
bool isPossible(vector<int>& stalls, int n, int c, int mid) {
int cows = 1;
int lastPos = stalls[0];
for (int i = 1; i < n; i++) {
if (stalls[i] - lastPos >= mid) {
cows++;
lastPos = stalls[i];
if (cows == c) return true;
}
}
return false;
}
int findLargestMinDist(vector<int>& stalls, int n, int c) {
sort(stalls.begin(), stalls.end());
int low = 1, high = stalls[n - 1] - stalls[0], ans = 0;
while (low <= high) {
int mid = low + (high - low) / 2;
if (isPossible(stalls, n, c, mid)) {
ans = mid;
low = mid + 1;
} else {
high = mid - 1;
}
}
return ans;
}
void solve()
{
int n, c;
cin >> n >> c;
vector<int> stalls(n);
for (int i = 0; i < n; i++) {
cin >> stalls[i];
}
cout << findLargestMinDist(stalls, n, c) << endl;
}
signed main() {
auto begin = high_resolution_clock::now();
#ifndef ONLINE_JUDGE
freopen("errorf.in","w",stderr);
#endif
ios::sync_with_stdio(false); \
cin.tie(nullptr); \
int t=1;
cin>>t;
while(t--){ solve(); }
auto end = high_resolution_clock::now();
auto elapsed = duration_cast<nanoseconds>(end - begin);
cerr << "Time measured: " << elapsed.count() * 1e-9 << " seconds.\n";
return 0;
}
I3ByYWdtYSBHQ0Mgb3B0aW1pemUoIk8zIikKI3ByYWdtYSBHQ0MgdGFyZ2V0ICgic3NlNCIpCiNpbmNsdWRlPGJpdHMvc3RkYysrLmg+CiNpbmNsdWRlIDxyYW5kb20+CiNpbmNsdWRlPGV4dC9wYl9kcy9hc3NvY19jb250YWluZXIuaHBwPgojaW5jbHVkZTxleHQvcGJfZHMvdHJlZV9wb2xpY3kuaHBwPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKdXNpbmcgbmFtZXNwYWNlIGNocm9ubzsKdXNpbmcgbmFtZXNwYWNlIF9fZ251X3BiZH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vKGZhbHNlKTsgXAogICAgY2luLnRpZShudWxscHRyKTsgICAgICAgICAgICAgICAgICBcCiAgICBpbnQgdD0xOwogICAgY2luPj50OwogICAgd2hpbGUodC0tKXsgc29sdmUoKTsgfQogICAgYXV0byBlbmQgPSBoaWdoX3Jlc29sdXRpb25fY2xvY2s6Om5vdygpOwogICAgYXV0byBlbGFwc2VkID0gZHVyYXRpb25fY2FzdDxuYW5vc2Vjb25kcz4oZW5kIC0gYmVnaW4pOwogICAgY2VyciA8PCAiVGltZSBtZWFzdXJlZDogIiA8PCBlbGFwc2VkLmNvdW50KCkgKiAxZS05IDw8ICIgc2Vjb25kcy5cbiI7IAogICAgcmV0dXJuIDA7Cn0=