For this Question: Given an unsorted array A of size N of non-negative integers, find a continuous sub-array which adds to a given number S.Each test case consists of two lines. The first line of each test case is N and S, where N is the size of the array and S is the sum. The second line of each test case contains N space-separated integers denoting the array elements.

<b>Constraints:-</b>
1 &le; N &le; 10<sup>5</sup>
1 &le; Ai &le; 10<sup>5</sup>Print the starting and ending positions (1 indexing) of first such occurring subarray from the left if sum equals to subarray, else print -1.Sample Input
5 12
1 2 3 7 5

Sample Output
2 4

Explanation:
subarray starting from index 2 and ending at index 4 => {2 , 3 , 7} 
sum = 2 + 3 + 7 = 12

Sample Input
10 15
1 2 3 4 5 6 7 8 9 10

Sample Output
1 5, I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
	public static void main (String[] args) throws IOException
	{
		try{


        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String StrInput[] = br.readLine().trim().split(" ");
		int n = Integer.parseInt(StrInput[0]);
		int s = Integer.parseInt(StrInput[1]);
		int arr[] = new int[n];
		String StrInput2[] = br.readLine().trim().split(" ");
		for(int i=0;i<n;i++)
		{
			arr[i] = Integer.parseInt(StrInput2[i]);
		}
		int sum = arr[0];
		int startingindex = 0;
		int endingindex = 1;
		int j = 0;
		int i;

			for(i=1;i<=n;i++)
			{
				if(sum < s && arr[i] != 0)
				{
					sum += arr[i];
				}
				while(sum > s && startingindex < i-1)
				{
					sum -= arr[startingindex];
					startingindex++;
				}
				if(sum == s)
				{
					endingindex = i+1;
					if(arr[0] == 0)
					{
						System.out.print(startingindex+2 + " " + endingindex);
					}
					else
					{
						System.out.print(startingindex+1 + " "+ endingindex);
					}
					break;
				}
				if(i == n && sum < s)
				{
					System.out.print(-1);
					break;
				}
			}
		}
		catch(Exception e)
		{
			System.out.print(-1);
		}
	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?