#include <bits/stdc++.h>   using namespace std;   const long long N = 1e9 + 5;   long long n, k;   bool valid(long long x) {     long long maxi = (x)*k - ((x - 1) * ((x + 2) / 2.0));     if (maxi >= n)       return true;     else       return false;   }   long long binary() {     long long lo = 0, mid, hi = k;     while (hi - lo > 0) {       mid = (hi + lo) / 2;       if (valid(mid))         hi = mid;       else         lo = mid + 1;     }     if (hi == lo)       return lo;     else       return -1;   }   int main() {     scanf( %I64d %I64d , &n, &k);     long long ans = binary();     long long maxi = k;     maxi += (ans - 1) * k - ((ans - 1) * ((ans + 2) / 2));     if (ans & 1 && ans != 1) maxi--;     if (maxi >= n)       printf( %I64d , ans);     else       printf( -1 );     return 0;   }   