#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
	unsigned long long n,x,i,a,zbir=0,min=1000000000000,max=0;
	cin>>n>>x;
	for(i=0;i<n;i++){
			cin>>a;
			if(a<min){
				min=a;
			}
			if(a>max){
				max=a;
			}		
	}
	if(x<min){
		zbir=zbir+(max-x);
	}
	if(x>max){
		zbir=zbir+(x-min);
	}
	if(x>min and x<max){
		zbir=zbir+2*(x-min)+(max-x);
	}
	cout<<max<<endl<<min<<endl<<zbir;
	
	return 0;
}