###双指针的优化
#include<bits/stdc++.h>
using namespace std;
int n,m;
const int N = 10010;
int arr[N];
int main()
{
cin>>n>>m;
int p = 0 ;
for(int i = 0 ; i < n ; i ++)
{
int x;
cin>>x;
if (x <= m )
arr[p++] = x;
}
sort(arr,arr+p);
int v1 = 0 , v2 = 0 ;
for (int i = p-1 ; i >= 0 ; i -- )
{
for (int j = 0 ; j < i ; j ++)
{
if (arr[j] + arr[i] == m)
{
v1 = arr[j];
v2 = arr[i];
break;
}
else if (arr[i] + arr[j] > m) break;
}
if (v1 || v2 ) break;
}
if (v1 || v2 ) cout<<v1<<" "<<v2;
else cout<<"No Solution";
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int n,m;
int a[100010];
int main()
{
cin>>n>>m;
for (int i = 0 ; i < n ; i ++)cin>>a[i];
sort(a,a+n);
for (int i = 0 , j = n-1 ; i < j ; i ++)
{
while (i < j && a[i] + a[j] > m) j --;
if (i < j && a[i] + a[j] == m)
{
cout<<a[i]<<" "<<a[j];
return 0;
}
}
cout<<"No Solution";
return 0;
}