#include
#include
#include"bits/stdc++.h"
using namespace std;
int main()
{
int n;
int target;
cin>>n>>target;
int a[1000];
for(int i=0;i<1000;i++)
{
cin>>a[i];
}
sort(a,a+n);
int strt=0;
int end=n-1;
while(strt<end)
{
int sum = a[strt] + a[end];
if(sum > target){
end--;
}
else if(sum<target){
strt++;
}
else if(sum==target)
{
cout<<strt<<" and "<<end<<endl;
strt++;
end--;
}
}
return 0;
}