#include <iostream>
using namespace std;
int main ()
{
    int a,b,n,x;
    cin>>n>>x;
    int mini=0,maxi=0;
    for (int i=0;i<n;i++)
    {
        cin>>a;
        a=a-x;
        if (a<mini)
            mini=a;
        else if (a>maxi)
            maxi=a;
    }
    cout<<mini<<endl<<maxi<<endl;
    if (mini<0)
    {
        if (maxi==0)
            b=-mini;
        else
        {
             if (-mini>maxi)
                b=-mini+maxi+maxi;
            else
                b=maxi-mini-mini;
        }
    }
    else
        b=maxi;
    cout<<b;
    return 0;
}