critical section

device int k=0;
global void
search1( int * values1,int *s, int NUM1, int target1)

int j=0;
unsigned int i = threadIdx.x + blockDim.x * blockIdx.x;
	atomicAdd(&s[k], i);


above code is simple searching algorithm where values contain the array in which we will look for target and i am storing found indexes in array s …
so above code results is output in which all indexes are added is s[0] while i want to store them differently in s[0], s[1] and so on…
so can any one help me with this …
it will be very thankful of you…