# Ice Cream Parlor

Sunny and Johnny together have M dollars and want to spend the amount at an ice cream parlour. The parlour offers N flavors, and they want to choose 2 flavors so that they end up spending the whole amount.

You are given a list of cost of these N flavors. The cost of ith flavor is denoted by (ci). You have to display the indices of two flavors whose sum is M.

Input Format

The first line of the input contains T, T test cases follow.
Each test case follows the format: The first line contains M. The second line contains N. The third line contains N single space separated integers denoting the price of each flavor. Here, ith integer denotes ci.

Output Format

Output two integers, each of which is a valid index of the flavor. The lower index must be printed first. Indices are indexed from 1 to N.

Constraints

1 ≤ T ≤ 50
2 ≤ M ≤ 10000
2 ≤ N ≤ 10000
1 ≤ ci ≤ 10000
The prices of two items may be same and each test case has a unique solution.

Sample Input

2
4
5
1 4 5 3 2
4
4
2 2 4 3

Sample Output

1 4
1 2

Explanation

The sample input has two test cases. For the 1st, the amount M = 4 and there are 5 flavors at the store. The flavors indexed at 1 and 4 sums to 4. For the 2nd test case, the amount M = 4 and the flavors indexed at 1 and 2 sums to 4.

Suggest Edits
7433 hackers have submitted code

```#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define MAX 10000
int main() {
int T,N,M,c[MAX],i,j,max,i1,i2;
scanf("%d",&T);
while(T--)
{
max=0;
i1=1;
i2=2;
scanf("%d%d",&M,&N);
for(i=0;i<N;i++)
scanf("%d",&c[i]);
for(i=0;i<(N-1);i++)
{
for(j=i+1;j<N;j++)
{
if((c[i]+c[j])>max && (c[i]+c[j])<= M)
{
max=c[i]+c[j];
i1=i+1;
i2=j+1;
if((c[i]+c[j]) == M)
break;
}
if((c[i]+c[j])==M)
break;

}
if((c[i]+c[j])==M)
break;
}
printf("%d %d\n",i1,i2);
}
return 0;
}
```

Compile & Run : http://ideone.com/TGi0zG