#include <stdio.h>
#include <iostream>
using
namespace
std;
#define max_length 1000000
void
find(
int
arr[],
int
n,
int
sum)
{
int
index1=0;
int
index2=n-1;
int
num1=-1,num2=-1;
while
(index1<index2)
{
if
(arr[index1]+arr[index2]==sum)
{
num1=arr[index1];
num2=arr[index2];
break
;
}
else
if
(arr[index1]+arr[index2]<sum)
{
index1++;
}
else
{
index2--;
}
}
cout<<num1<<
" "
<<num2<<endl;
}
int
main()
{
int
array[max_length];
for
(
int
i=0;i<max_length;i++)
{
array[i]=0;
}
int
num;
int
theSum;
while
(cin>>num>>theSum){
for
(
int
i=0;i<num;i++)
{
//cin>>array[i];
scanf
(
"%d"
,&array[i]);
}
find(array,num,theSum);
}
return
0;
}
/**************************************************************
Problem: 1352
User: 无梦楼主lv
Language: C++
Result: Accepted
Time:1460 ms
Memory:5356 kb
****************************************************************/