#include <bits/stdc++.h>   using namespace std;   void solve() {     long long n, k;     cin >> n >> k;     vector<long long> a(n);     for (long long &i : a) cin >> i;     sort(a.begin(), a.end());     a.resize(unique(a.begin(), a.end()) - a.begin());     n = a.size();     if (k == 1 and n > 1) {       cout << -1 << endl;       return;     } else if (k >= n) {       cout << 1 << endl;       return;     }     long long ans;     ans = 1, n -= k, k--;     ans += (n + k - 1) / k;     cout << ans << endl;   }   int32_t main() {     ios_base::sync_with_stdio(false), cin.tie(nullptr), cin.tie(nullptr);     long long t_c = 1;     cin >> t_c;     while (t_c--) solve();   }   