Subtract sum from second array elements one by one and check it 's present in array first  or not
for ( int j = 0 ; j < m ; j ++ ) { if ( s . ContainsKey ( x - arr2 [ j ] ) ) { Console . WriteLine ( x - arr2 [ j ] + " ▁ " + arr2 [ j ] ) ; } } }