Try to work hard !

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.ArrayList;


public class Main {
	
	public static void main(String[] args) {
		
		InputStream in = System.in;
		Reader isr = new InputStreamReader(in);
		BufferedReader br = new BufferedReader(isr);
		
		String[] input;
		int whatNumber = 0;
		int minlength = 0;
		try {
			input = br.readLine().split(" ");
			whatNumber = Integer.parseInt(input[0]);
			minlength = Integer.parseInt(input[1]);
		} catch (IOException e) {
			// e.printStackTrace();
		} 
		
		for(int i=minlength ; i <=100 ; i++) {
			
			if(getSolution(i, whatNumber)) {
				// log("getSolution(%d, %d)", i, whatNumber);
				printAnswear(i, whatNumber);
				break;
			}
			if(i==100) {
				log("-1");
			}
		}
		
	}

	// n : n 개의 연속 되는 수
	public static boolean getSolution(int n, int result) {
		// n = 1 일 때      k (단, k는 자연수 ) 
		// n = 2 일 때     2k + 1
		// n = n 일 때  nk + n(n-1)/2
		
		// result = nk + n(n-1)/2
		// result - n(n-1)/2 = nk
		// [result - n(n-1)/2] % n == 0 이라면 k정수가 존재
		
		int x = result - n*(n-1)/2;
		if(x < 0) {
			return false;
		}
		
		boolean okay = (x % n == 0) ;
		
		return okay;
	}

	public static void printAnswear(int n, int result) {
		int first = (result - n*(n-1)/2) / n;
		
		String Str = "";
		for(int i=0; i<n; i++) {
			Str += String.format("%d ", first+i);
		}
		System.out.println(Str.trim());
	}
	
	public static void log(String input) {	System.out.println(input);	}

	public static void log(String input, Object ...args) {
		System.out.println(String.format(input, args));
	}
	
}


Comment +0