GRUBAN Doubt?

#include <bits/stdc++.h>
using namespace std;
void find_Divisors(long int n,long int k,long int Min)
{
long int ans=1;
for (long int i=2; i<=sqrt(n); i++)
{
if (n%i == 0)
{
if (n/i == i)
{
if(i>=Min)
{
ans=max(ans,i);
}
}
else
{
if(i>=Min)
{
ans=max(ans,n/i);
}
if(n/i>=Min)
{
ans=max(ans,i);
}
}
}
}
cout<<ans<<"\n";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int cases;
cin>>cases;
long int N,K;
while(cases–)
{
cin>>N>>K;
long int minimum_N=(K*(K+1))/2;
if(N<K)
{
cout<<-1<<"\n";
}
else
{
if(N<minimum_N)
{
cout<<-1<<"\n";
}
else
{
if(N==minimum_N)
{
cout<<1<<"\n";
}
else
{
find_Divisors(N,K,minimum_N);
}

            }
        }
    }
    return 0;

}

why i was getting wrong answer