Var
a:array[1..100] of integer;kt:boolean;
fi,fo:text;min,max,t,d,i,j,n,vt1,vt2:integer;
Begin
Assign(fi,'hang.inp');reset(fi);
Assign(fo,'hang.out');rewrite(fo);
readln(fi,n,t);d:=0;kt:=false;
For i:=1 to n do read(fi,a[i]);
max:=0;min:=t;
For i:=1 to n do
begin
If a[i]>max then max:=a[i];
If a[i]<min then min:=a[i];
end;
For i:=1 to n-1 do
For j:=i+1 to n do
If (a[i]+a[j]=t) then d:=d+1;
Writeln(fo,d);
For i:=1 to n-1 do
For j:=i+1 to n do
If ((a[i]=min) and (a[j]=max) and (a[i]+a[j]=t)) or
((a[i]=max) and (a[j]=min) and (a[i]+a[j]=t)) then
begin vt1:=i;vt2:=j;kt:=true;end;
If kt=true then write(fo,vt1,' ',vt2) else write(fo,0);
Close(fi);Close(fo);
End.