#include #include #include #include #include #include #include #include #include #include #include #include #include //#include #define Size 100005 #define inf 2e9 #define INF 2e18 #define LL long long #define i64 __int64 #define ULL unsigned long long #define Mod 1000000007 using namespace std; LL n,m,k; int main() { #ifndef ONLINE_JUDGE // freopen("input.txt","r",stdin); // freopen("output.txt","w",stdout); #endif // ONLINE_JUDGE LL t; LL x,y,z; // LL Case=0; cin>>t; while(t--) // cin>>n; // while(scanf("%I64d%I64d",&n,&m)==2) { cin>>n>>k; if(n < (k+1)*k/2) { cout<<-1<