#include <stdio.h> int main(){ int a,b; scanf("%d%d",&a,&b); int m=b*(b+1)/2; if(a<m) printf("-1"); else if((m-a)%b==0) printf("%d",b-1); else printf("%d",b); return 0; }
To embed this project on your website, copy the following code and paste it into your website's HTML: