#include <bits/stdc++.h>

using namespace std;

void solve(){
    int t; cin >> t;
    while(t--){
        int n,k; cin >> n >> k;
        vector<int> nums(n);
        for(int i = 0; i < n; i++) cin >> nums[i];

        vector<int> peaks;
        for(int i = 2; i < n; i++){
            if(nums[i - 1] > nums[i - 2] && nums[i - 1] > nums[i]){
                peaks.push_back(i);
            }
        }

        int max_count = 0;
        int left_res = 0;
        for(int i = 0; i < peaks.size(); i++){
            int right = peaks[i] - 1 + k;

            auto endp = lower_bound(peaks.begin(), peaks.end(), right); endp--;
            int end_idx = endp - peaks.begin();

            // cout << i << " - " << end_idx << " " << peaks[i] << " - " << (*endp) << endl;
            if(end_idx >= i && end_idx - i + 1 > max_count){
                max_count = end_idx - i + 1;
                left_res = max(1, (*endp) + 1 - (k - 1));
            }
        }

        cout << max_count + 1 << " " << left_res<< endl;
    }

}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    solve();

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

void solve(){
    int t; cin >> t;
    while(t--){
        int n,k; cin >> n >> k;
        vector<int> nums(n);
        for(int i = 0; i < n; i++) cin >> nums[i];

        vector<int> peaks(n + 1, 0);
        for(int i = 2; i < n; i++){
            if(nums[i - 1] > nums[i - 2] && nums[i - 1] > nums[i]){
                peaks[i]++;
            }
            peaks[i + 1] = peaks[i];
        }

        // for(int i = 0; i < peaks.size(); i++){
        //     cout << peaks[i] << " ";
        // }
        // cout << endl;
        int max_count = 0;
        int start = 1;
        for(int i = 1; i <= n - k + 1; i++){
            int cur_count = peaks[i + k - 2] - peaks[i];
            if(cur_count > max_count){
                max_count = cur_count;
                start = i;
            }
        }

        cout << max_count + 1 << " " << start << endl;
    }

}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    solve();

    return 0;
}


/*
                                Bismillahi-r-Rahmani-r-Rahim
                                        RhIeyAaD
                                    IIT-7th Batch,JU
*/
#include<bits/stdc++.h>
using namespace std;

#define debug(args...){ string _s = #args;replace(_s.begin(),_s.end(),',', ' ');stringstream _ss(_s);istream_iterator<string>_it(_ss);err(_it, args);}
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {cerr << *it << "=" << a << ", "; err(++it, args...);}

#define ll              long long int
#define MAX             2134567891
#define fr(i,n)         for(i=0;i<n;i++)
#define rep(i,n)        for(i=1;i<=n;i++)
#define rev(i,a,n)      for(i=n;i>=a;i--)
#define FOR(i,a,n)      for(i=a;i<=n;i++)
#define ALL(n)          n.begin(),n.end()
#define mem(x,n)        memset(x,n,sizeof(x))
#define TC(t)           printf("Case %lld: ",t)
#define ans(t,c)        printf("Case %lld: %lld\n",t,c)
#define SETP(n)         cout<<setprecision(n)<<fixed
#define READ            freopen("F:\\Project\\Test_Case.txt","r",stdin)
#define WRITE           freopen("F:\\Project\\Output_Test.txt","w",stdout)
#define IO              ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
#define PAIR            pair<ll,ll>
#define MP              make_pair
#define pb(a)           push_back(a)
#define ff              first
#define ss              second
#define NL              printf("\n");
#define bug(a)          cout<<#a<<" "<<a<<" ";
#define hlw             printf("hlw\n");
#define NN              111
#define MOD             1000000007///10^9
#define N               1000007 ///10^6->6 zero after 1 **

ll x[N],y[N],z[N],n;
string s,S;
vector<ll>v;
//map <ll,ll> mp;

int main()
{
    //IO;
    //while(1)
    //READ;WRITE;
{
    ll a=0,b=0,c=0,d,e,f,g,i,j,k,l,m,p,q,r,u,w,t,tc=1,in,mod,loc,diff,val,sz,lo,hi,mid,mn=MAX,mx=0,sum=0,ans=0;
cin>>tc;
rep(t,tc)
{
    cin>>n>>k;
    ans=-1,in=0;
    rep(i,n)
    {
        cin>>x[i];
        y[i]=0;
    }
    for(i=2;i<n;i++)
    {
        y[i]=y[i-1];
        if(x[i]>x[i-1] && x[i]>x[i+1])y[i]++;
        a=y[i]-y[i-k+1];
        if(a>ans)
        {
            in=max(0ll,i-k+1),ans=a;
        }
    }
    cout<<ans+1<<" "<<in+1<<endl;
}
}
    return 0;
}

/*

*/
/// Check for constraint 0 or 1?
/// Division MOD needs BigMod(a,n-2)
/// long long or double? sqrt or division will work fine??


/*
                                Bismillahi-r-Rahmani-r-Rahim
                                        RhIeyAaD
                                    IIT-7th Batch,JU
*/
#include<bits/stdc++.h>
using namespace std;

#define debug(args...){ string _s = #args;replace(_s.begin(),_s.end(),',', ' ');stringstream _ss(_s);istream_iterator<string>_it(_ss);err(_it, args);}
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {cerr << *it << "=" << a << ", "; err(++it, args...);}

#define ll              long long int
#define MAX             2134567891
#define fr(i,n)         for(i=0;i<n;i++)
#define rep(i,n)        for(i=1;i<=n;i++)
#define rev(i,a,n)      for(i=n;i>=a;i--)
#define FOR(i,a,n)      for(i=a;i<=n;i++)
#define ALL(n)          n.begin(),n.end()
#define mem(x,n)        memset(x,n,sizeof(x))
#define TC(t)           printf("Case %lld: ",t)
#define ans(t,c)        printf("Case %lld: %lld\n",t,c)
#define SETP(n)         cout<<setprecision(n)<<fixed
#define READ            freopen("F:\\Project\\Test_Case.txt","r",stdin)
#define WRITE           freopen("F:\\Project\\Output_Test.txt","w",stdout)
#define IO              ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
#define PAIR            pair<ll,ll>
#define MP              make_pair
#define pb(a)           push_back(a)
#define ff              first
#define ss              second
#define NL              printf("\n");
#define bug(a)          cout<<#a<<" "<<a<<" ";
#define hlw             printf("hlw\n");
#define NN              111
#define MOD             1000000007///10^9
#define N               1000007 ///10^6->6 zero after 1 **

ll n;
string s,S;
vector<ll>v;
//map <ll,ll> mp;

int main()
{
    //IO;
    //while(1)
    //READ;WRITE;
{
    ll a=0,b=0,c=0,d,e,f,g,i,j,k,l,m,p,q,r,u,w,t,tc=1,in,mod,loc,diff,val,sz,lo,hi,mid,mn=MAX,mx=0,sum=0,ans=0;
cin>>tc;
rep(t,tc)
{
    cin>>n>>k;
    vector<ll>x (n+2),y(n+2);
    rep(i,n)cin>>x[i];
    ans=-1;in=-1;
    for(i=2;i<n;i++)
    {
        y[i]=y[i-1];
        if(x[i]>x[i-1] && x[i]>x[i+1])y[i]++;
        a=y[i]-y[i-k+1];
        if(a>ans)
            in=i-k+1,ans=a;

    }

//    a=y[n]-y[n-k+1];
//    if(a>ans)
//        in=n-k+1,ans=a;
    //cout<<ans<<" L "<<in<<" R "<<in+k-1<<endl;
    cout<<ans+1<<" "<<in+1<<endl;
}
}
    return 0;
}

/*

*/
/// Check for constraint 0 or 1?
/// Division MOD needs BigMod(a,n-2)
/// long long or double? sqrt or division will work fine??


/*
                                Bismillahi-r-Rahmani-r-Rahim
                                        RhIeyAaD
                                    IIT-7th Batch,JU
*/
#include<bits/stdc++.h>
using namespace std;

#define debug(args...){ string _s = #args;replace(_s.begin(),_s.end(),',', ' ');stringstream _ss(_s);istream_iterator<string>_it(_ss);err(_it, args);}
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {cerr << *it << "=" << a << ", "; err(++it, args...);}

#define ll              long long int
#define MAX             2134567891
#define fr(i,n)         for(i=0;i<n;i++)
#define rep(i,n)        for(i=1;i<=n;i++)
#define rev(i,a,n)      for(i=n;i>=a;i--)
#define FOR(i,a,n)      for(i=a;i<=n;i++)
#define ALL(n)          n.begin(),n.end()
#define mem(x,n)        memset(x,n,sizeof(x))
#define TC(t)           printf("Case %lld: ",t)
#define ans(t,c)        printf("Case %lld: %lld\n",t,c)
#define SETP(n)         cout<<setprecision(n)<<fixed
#define READ            freopen("F:\\Project\\Test_Case.txt","r",stdin)
#define WRITE           freopen("F:\\Project\\Output_Test.txt","w",stdout)
#define IO              ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
#define PAIR            pair<ll,ll>
#define MP              make_pair
#define pb(a)           push_back(a)
#define ff              first
#define ss              second
#define NL              printf("\n");
#define bug(a)          cout<<#a<<" "<<a<<" ";
#define hlw             printf("hlw\n");
#define NN              111
#define MOD             1000000007///10^9
#define N               1000007 ///10^6->6 zero after 1 **

ll n;
string s,S;
vector<ll>v;
//map <ll,ll> mp;

int main()
{
    //IO;
    //while(1)
    //READ;WRITE;
{
    ll a=0,b=0,c=0,d,e,f,g,i,j,k,l,m,p,q,r,u,w,t,tc=1,in,mod,loc,diff,val,sz,lo,hi,mid,mn=MAX,mx=0,sum=0,ans=0;
cin>>tc;
rep(t,tc)
{
    cin>>n>>k;
    vector<ll>x (n+2),y(n+2);
    rep(i,n)cin>>x[i];
    ans=-99;in=0;
    for(i=2;i<n;i++)
    {
        y[i]=y[i-1];
        if(x[i]>x[i-1] && x[i]>x[i+1])y[i]++;
        a=y[i]-y[i-k+1];
        if(a>ans)
            in=i-k+1,ans=a;

    }

//    a=y[n]-y[n-k+1];
//    if(a>ans)
//        in=n-k+1,ans=a;
    //cout<<ans<<" L "<<in<<" R "<<in+k-1<<endl;
    cout<<ans+1<<" "<<in+1<<endl;
}
}
    return 0;
}

/*

*/
/// Check for constraint 0 or 1?
/// Division MOD needs BigMod(a,n-2)
/// long long or double? sqrt or division will work fine??


/*
                                Bismillahi-r-Rahmani-r-Rahim
                                        RhIeyAaD
                                    IIT-7th Batch,JU
*/
#include<bits/stdc++.h>
using namespace std;

#define debug(args...){ string _s = #args;replace(_s.begin(),_s.end(),',', ' ');stringstream _ss(_s);istream_iterator<string>_it(_ss);err(_it, args);}
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {cerr << *it << "=" << a << ", "; err(++it, args...);}

#define ll              long long int
#define MAX             2134567891
#define fr(i,n)         for(i=0;i<n;i++)
#define rep(i,n)        for(i=1;i<=n;i++)
#define rev(i,a,n)      for(i=n;i>=a;i--)
#define FOR(i,a,n)      for(i=a;i<=n;i++)
#define ALL(n)          n.begin(),n.end()
#define mem(x,n)        memset(x,n,sizeof(x))
#define TC(t)           printf("Case %lld: ",t)
#define ans(t,c)        printf("Case %lld: %lld\n",t,c)
#define SETP(n)         cout<<setprecision(n)<<fixed
#define READ            freopen("F:\\Project\\Test_Case.txt","r",stdin)
#define WRITE           freopen("F:\\Project\\Output_Test.txt","w",stdout)
#define IO              ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
#define PAIR            pair<ll,ll>
#define MP              make_pair
#define pb(a)           push_back(a)
#define ff              first
#define ss              second
#define NL              printf("\n");
#define bug(a)          cout<<#a<<" "<<a<<" ";
#define hlw             printf("hlw\n");
#define NN              111
#define MOD             1000000007///10^9
#define N               1000007 ///10^6->6 zero after 1 **

ll x[N],y[N],n;
string s,S;
vector<ll>v;
//map <ll,ll> mp;

int main()
{
    //IO;
    //while(1)
    //READ;WRITE;
{
    ll a=0,b=0,c=0,d,e,f,g,i,j,k,l,m,p,q,r,u,w,t,tc=1,in,mod,loc,diff,val,sz,lo,hi,mid,mn=MAX,mx=0,sum=0,ans=0;
cin>>tc;
rep(t,tc)
{
    cin>>n>>k;
    ans=0,in=1;
    rep(i,n)
    {
        cin>>x[i];
        y[i]=0;
    }
    for(i=2;i<n;i++)
    {
        y[i]=y[i-1];
        if(x[i]>x[i-1] && x[i]>x[i+1])y[i]++;
    }
    for(i=1;i<=n-k+1;i++)
    {
        a=y[i+k-2]-y[i];
        if(a>ans)
            ans=a,in=i;
    }

    cout<<ans+1<<" "<<in<<endl;
}
}
    return 0;
}

/*

*/
/// Check for constraint 0 or 1?
/// Division MOD needs BigMod(a,n-2)
/// long long or double? sqrt or division will work fine??


/*
                                Bismillahi-r-Rahmani-r-Rahim
                                        RhIeyAaD
                                    IIT-7th Batch,JU
*/
#include<bits/stdc++.h>
using namespace std;

#define debug(args...){ string _s = #args;replace(_s.begin(),_s.end(),',', ' ');stringstream _ss(_s);istream_iterator<string>_it(_ss);err(_it, args);}
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {cerr << *it << "=" << a << ", "; err(++it, args...);}

#define ll              long long int
#define MAX             2134567891
#define fr(i,n)         for(i=0;i<n;i++)
#define rep(i,n)        for(i=1;i<=n;i++)
#define rev(i,a,n)      for(i=n;i>=a;i--)
#define FOR(i,a,n)      for(i=a;i<=n;i++)
#define ALL(n)          n.begin(),n.end()
#define mem(x,n)        memset(x,n,sizeof(x))
#define TC(t)           printf("Case %lld: ",t)
#define ans(t,c)        printf("Case %lld: %lld\n",t,c)
#define SETP(n)         cout<<setprecision(n)<<fixed
#define READ            freopen("F:\\Project\\Test_Case.txt","r",stdin)
#define WRITE           freopen("F:\\Project\\Output_Test.txt","w",stdout)
#define IO              ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
#define PAIR            pair<ll,ll>
#define MP              make_pair
#define pb(a)           push_back(a)
#define ff              first
#define ss              second
#define NL              printf("\n");
#define bug(a)          cout<<#a<<" "<<a<<" ";
#define hlw             printf("hlw\n");
#define NN              111
#define MOD             1000000007///10^9
#define N               1000007 ///10^6->6 zero after 1 **

ll x[N],y[N],z[N],n;
string s,S;
vector<ll>v;
//map <ll,ll> mp;

int main()
{
    //IO;
    //while(1)
    //READ;WRITE;
{
    ll a=0,b=0,c=0,d,e,f,g,i,j,k,l,m,p,q,r,u,w,t,tc=1,in,mod,loc,diff,val,sz,lo,hi,mid,mn=MAX,mx=0,sum=0,ans=0;
cin>>tc;
rep(t,tc)
{
    cin>>n>>k;
    ans=0,in=1;
    rep(i,n)
    {
        cin>>x[i];
        y[i]=0;
    }
    for(i=2;i<n;i++)
    {
        y[i]=y[i-1];
        if(x[i]>x[i-1] && x[i]>x[i+1])y[i]++;
        a=y[i]-y[i-k+2];
        if(a>ans)
        {
            in=max(1ll,i-k+2),ans=a;
            //cout<<i<<" "<<y[i]<<" i a "<<a<<" in "<<in<<endl;
        }
    }
    if(ans!=0)ans++;
    cout<<ans<<" "<<in<<endl;
}
}
    return 0;
}

/*

*/
/// Check for constraint 0 or 1?
/// Division MOD needs BigMod(a,n-2)
/// long long or double? sqrt or division will work fine??


/*
                                Bismillahi-r-Rahmani-r-Rahim
                                        RhIeyAaD
                                    IIT-7th Batch,JU
*/
#include<bits/stdc++.h>
using namespace std;

#define debug(args...){ string _s = #args;replace(_s.begin(),_s.end(),',', ' ');stringstream _ss(_s);istream_iterator<string>_it(_ss);err(_it, args);}
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {cerr << *it << "=" << a << ", "; err(++it, args...);}

#define ll              long long int
#define MAX             2134567891
#define fr(i,n)         for(i=0;i<n;i++)
#define rep(i,n)        for(i=1;i<=n;i++)
#define rev(i,a,n)      for(i=n;i>=a;i--)
#define FOR(i,a,n)      for(i=a;i<=n;i++)
#define ALL(n)          n.begin(),n.end()
#define mem(x,n)        memset(x,n,sizeof(x))
#define TC(t)           printf("Case %lld: ",t)
#define ans(t,c)        printf("Case %lld: %lld\n",t,c)
#define SETP(n)         cout<<setprecision(n)<<fixed
#define READ            freopen("F:\\Project\\Test_Case.txt","r",stdin)
#define WRITE           freopen("F:\\Project\\Output_Test.txt","w",stdout)
#define IO              ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
#define PAIR            pair<ll,ll>
#define MP              make_pair
#define pb(a)           push_back(a)
#define ff              first
#define ss              second
#define NL              printf("\n");
#define bug(a)          cout<<#a<<" "<<a<<" ";
#define hlw             printf("hlw\n");
#define NN              111
#define MOD             1000000007///10^9
#define N               1000007 ///10^6->6 zero after 1 **

ll n;
string s,S;
vector<ll>v;
//map <ll,ll> mp;

int main()
{
    //IO;
    //while(1)
    //READ;WRITE;
{
    ll a=0,b=0,c=0,d,e,f,g,i,j,k,l,m,p,q,r,u,w,t,tc=1,in,mod,loc,diff,val,sz,lo,hi,mid,mn=MAX,mx=0,sum=0,ans=0;
cin>>tc;
rep(t,tc)
{
    cin>>n>>k;
    vector<ll>x (n+2),y(n+2);
    rep(i,n)cin>>x[i];
    ans=0;in=-1;
    for(i=2;i<n;i++)
    {
        y[i]=y[i-1];
        if(x[i]>x[i-1] && x[i]>x[i+1])y[i]++;
        a=y[i]-y[i-k+1];
        if(a>ans)
            in=i-k+1,ans=a;

    }

//    a=y[n]-y[n-k+1];
//    if(a>ans)
//        in=n-k+1,ans=a;
    //cout<<ans<<" L "<<in<<" R "<<in+k-1<<endl;
    cout<<ans+1<<" "<<in+1<<endl;
}
}
    return 0;
}

/*

*/
/// Check for constraint 0 or 1?
/// Division MOD needs BigMod(a,n-2)
/// long long or double? sqrt or division will work fine??


/*
                                Bismillahi-r-Rahmani-r-Rahim
                                        RhIeyAaD
                                    IIT-7th Batch,JU
*/
#include<bits/stdc++.h>
using namespace std;

#define debug(args...){ string _s = #args;replace(_s.begin(),_s.end(),',', ' ');stringstream _ss(_s);istream_iterator<string>_it(_ss);err(_it, args);}
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {cerr << *it << "=" << a << ", "; err(++it, args...);}

#define ll              long long int
#define MAX             2134567891
#define fr(i,n)         for(i=0;i<n;i++)
#define rep(i,n)        for(i=1;i<=n;i++)
#define rev(i,a,n)      for(i=n;i>=a;i--)
#define FOR(i,a,n)      for(i=a;i<=n;i++)
#define ALL(n)          n.begin(),n.end()
#define mem(x,n)        memset(x,n,sizeof(x))
#define TC(t)           printf("Case %lld: ",t)
#define ans(t,c)        printf("Case %lld: %lld\n",t,c)
#define SETP(n)         cout<<setprecision(n)<<fixed
#define READ            freopen("F:\\Project\\Test_Case.txt","r",stdin)
#define WRITE           freopen("F:\\Project\\Output_Test.txt","w",stdout)
#define IO              ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
#define PAIR            pair<ll,ll>
#define MP              make_pair
#define pb(a)           push_back(a)
#define ff              first
#define ss              second
#define NL              printf("\n");
#define bug(a)          cout<<#a<<" "<<a<<" ";
#define hlw             printf("hlw\n");
#define NN              111
#define MOD             1000000007///10^9
#define N               1000007 ///10^6->6 zero after 1 **

ll x[N],y[N],n;
string s,S;
vector<ll>v;
//map <ll,ll> mp;

int main()
{
    //IO;
    //while(1)
    //READ;WRITE;
{
    ll a=0,b=0,c=0,d,e,f,g,i,j,k,l,m,p,q,r,u,w,t,tc=1,in,mod,loc,diff,val,sz,lo,hi,mid,mn=MAX,mx=0,sum=0,ans=0;
cin>>tc;
rep(t,tc)
{
    cin>>n>>k;
    ans=0,in=1;
    rep(i,n)
    {
        cin>>x[i];
        y[i]=0;
    }
    for(i=2;i<n;i++)
    {
        y[i]=y[i-1];
        if(x[i]>x[i-1] && x[i]>x[i+1])y[i]++;
    }
    for(i=1;i<=n-k+1;i++)
    {
        a=y[i+k-2]-y[i];
        if(a>ans)
            ans=a,in=i;
    }
    if(ans!=0)ans++;
    cout<<ans<<" "<<in<<endl;
}
}
    return 0;
}

/*

*/
/// Check for constraint 0 or 1?
/// Division MOD needs BigMod(a,n-2)
/// long long or double? sqrt or division will work fine??


/*
                                Bismillahi-r-Rahmani-r-Rahim
                                        RhIeyAaD
                                    IIT-7th Batch,JU
*/
#include<bits/stdc++.h>
using namespace std;

#define debug(args...){ string _s = #args;replace(_s.begin(),_s.end(),',', ' ');stringstream _ss(_s);istream_iterator<string>_it(_ss);err(_it, args);}
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {cerr << *it << "=" << a << ", "; err(++it, args...);}

#define ll              long long int
#define MAX             2134567891
#define fr(i,n)         for(i=0;i<n;i++)
#define rep(i,n)        for(i=1;i<=n;i++)
#define rev(i,a,n)      for(i=n;i>=a;i--)
#define FOR(i,a,n)      for(i=a;i<=n;i++)
#define ALL(n)          n.begin(),n.end()
#define mem(x,n)        memset(x,n,sizeof(x))
#define TC(t)           printf("Case %lld: ",t)
#define ans(t,c)        printf("Case %lld: %lld\n",t,c)
#define SETP(n)         cout<<setprecision(n)<<fixed
#define READ            freopen("F:\\Project\\Test_Case.txt","r",stdin)
#define WRITE           freopen("F:\\Project\\Output_Test.txt","w",stdout)
#define IO              ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
#define PAIR            pair<ll,ll>
#define MP              make_pair
#define pb(a)           push_back(a)
#define ff              first
#define ss              second
#define NL              printf("\n");
#define bug(a)          cout<<#a<<" "<<a<<" ";
#define hlw             printf("hlw\n");
#define NN              111
#define MOD             1000000007///10^9
#define N               1000007 ///10^6->6 zero after 1 **

ll x[N],y[N],n;
string s,S;
vector<ll>v;
//map <ll,ll> mp;

int main()
{
    //IO;
    //while(1)
    //READ;WRITE;
{
    ll a=0,b=0,c=0,d,e,f,g,i,j,k,l,m,p,q,r,u,w,t,tc=1,in,mod,loc,diff,val,sz,lo,hi,mid,mn=MAX,mx=0,sum=0,ans=0;
cin>>tc;
rep(t,tc)
{
    cin>>n>>k;
    ans=0,in=1;
    rep(i,n)
    {
        cin>>x[i];
        y[i]=0;
    }
    for(i=2;i<n;i++)
    {
        y[i]=y[i-1];
        if(x[i]>x[i-1] && x[i]>x[i+1])y[i]++;
    }
    for(i=n-1;i>=k-1;i--)
    {
        a=y[i]-y[i-k+2];
        //debug(i,y[i],a,(i-k+2),y[i-k+2],ans,in);NL
        if(a>=ans)
        {
            ans=a;
            in=i-k+2;
            //cout<<"In\n";
        }
    }
    if(ans!=0)ans++;
    cout<<ans<<" "<<in<<endl;
}
}
    return 0;
}

/*

*/
/// Check for constraint 0 or 1?
/// Division MOD needs BigMod(a,n-2)
/// long long or double? sqrt or division will work fine??


#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;
const int maxn=2e5+10;
LL a[maxn];
LL vis[maxn];
LL peak[maxn];
int main(void)
{
	cin.tie(0);std::ios::sync_with_stdio(false);
	LL t;cin>>t;
	while(t--)
	{
		LL n,k;cin>>n>>k;
		//边界
		LL f=1;
	//	memset(a,0,sizeof(a));memset(vis,0,sizeof(vis));memset(peak,0,sizeof(peak));
		for(LL i=1;i<=2*n;i++)
		{
			a[i]=0;vis[i]=0;peak[i]=0;
		}
		for(LL i=1;i<=n;i++) cin>>a[i];

		for(LL i=1;i<n;i++)
		{

			if(i!=1&&a[i]>a[i+1]&&a[i]>a[i-1])
				{
					peak[f++]=i;
					vis[i]=1;
				}
		}
		///<
		LL _l=1;LL ans=0;
		for(LL i=1;i<f;i++)
		{
			LL res=1;
			for(LL j=peak[i]-k+2;j<=peak[i];j++)
				{
					if(vis[j])
					{
						res++;
					}
				}
			if(ans<res)
			{
				ans=res;_l=max((LL)1,peak[i]-k+2);
			}
		}
		if(ans)
		cout<<ans<<' '<<_l<<endl;
		else if(ans==0)
		cout<<1<<' '<<1<<endl;
	}

return 0;
}


#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;
const int maxn=2e5+10;
LL a[maxn];
LL vis[maxn];
LL peak[maxn];
int main(void)
{
	LL t;cin>>t;
	while(t--)
	{
		LL n,k;cin>>n>>k;
		//边界
		LL f=1;
		memset(a,0,sizeof(a));memset(vis,0,sizeof(vis));memset(peak,0,sizeof(peak));
		for(LL i=1;i<=n;i++) cin>>a[i];

		for(LL i=1;i<n;i++)
		{

			if(i!=1&&a[i]>a[i+1]&&a[i]>a[i-1])
				{
					peak[f++]=i;
					vis[i]=1;
				}
		}
		///<
		LL _l=1;LL ans=0;
		for(LL i=1;i<f;i++)
		{
			LL res=1;
			for(LL j=peak[i]-k+2;j<=peak[i];j++)
				{
					if(vis[j])
					{
						res++;
					}
				}
			if(ans<res)
			{
				ans=res;_l=max((LL)1,peak[i]-k+2);
			}
		}
		cout<<ans<<' '<<_l<<endl;
	}

return 0;
}


#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;
const int maxn=2e5+10;
LL a[maxn];
LL l[maxn];
int main(void)
{
	LL t;cin>>t;
	while(t--)
	{
		LL n,k;cin>>n>>k;memset(a,0,sizeof(a));memset(l,0,sizeof(l));
		for(LL i=1;i<=n;i++)
			{
				cin>>a[i];
			}
		for(LL i=1;i<=n;i++)
		{
			LL j=i;
			LL res=0;
			while(j-i+1<k)
			{
				if( ( j-1!=0) &&a[j]>a[j-1]&&a[j]>a[j+1]) res++;
				j++;
			}
			l[i]=res;//cout<<"res="<<res<<endl;cout<<"i="<<i<<endl;

		}
		LL ans=0;LL _l=1;
		for(LL i=1;i<=n;i++)
		{
			if(ans<l[i])
			{
				ans=l[i];_l=i;//cout<<"ans="<<ans<<endl;cout<<"_l="<<_l<<endl;
			}
		}
		cout<<ans+1<<' '<<_l<<endl;
	}

return 0;
}


#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;
const int maxn=2e5+10;
LL b[maxn];
LL w[maxn];
LL f[maxn];
int main(void)
{
	int n,t,k;
	cin>>t;
	for(int p=1;p<=t;p++)
	{
		cin>>n>>k;
		for(int i=1;i<=n;i++) cin>>b[i],w[i]=b[i]-b[i-1];

		memset(f,0,sizeof(f));

		for(int i=2;i<n;i++)
		if(w[i]>0&&w[i+1]<0)
			f[i+1]++,f[i+k-1]--;
		int res=0,cnt=0;
		for(int i=2;i<=n;i++)
		{
			f[i]+=f[i-1];
			if(f[i]>cnt)
			{
				res=i-k+1;
				cnt=f[i];
			}
		}
		if(res<=0) res=1;
		cout<<cnt+1<<' '<<res<<endl;
	}

return 0;
}


#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;
const int maxn=2e5+10;
LL a[maxn];
LL vis[maxn];
LL peak[maxn];
int main(void)
{
	cin.tie(0);std::ios::sync_with_stdio(false);
	LL t;cin>>t;
	while(t--)
	{
		LL n,k;cin>>n>>k;
		//边界
		LL f=1;
	//	memset(a,0,sizeof(a));memset(vis,0,sizeof(vis));memset(peak,0,sizeof(peak));
		for(LL i=1;i<=2*n;i++)
		{
			a[i]=0;vis[i]=0;peak[i]=0;
		}
		for(LL i=1;i<=n;i++) cin>>a[i];

		for(LL i=1;i<n;i++)
		{

			if(i!=1&&a[i]>a[i+1]&&a[i]>a[i-1])
				{
					peak[f++]=i;
					vis[i]=1;
				}
		}
		///<
		LL _l=1;LL ans=0;
		for(LL i=1;i<f;i++)
		{
			LL res=1;
			for(LL j=peak[i]-k+2;j<=peak[i];j++)
				{
					if(vis[j])
					{
						res++;
					}
				}
			if(ans<res)
			{
				ans=res;_l=max((LL)1,peak[i]-k+2);
			}
		}
		cout<<ans<<' '<<_l<<endl;
	}

return 0;
}


#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;
const int maxn=2e5+10;
LL a[maxn];
LL vis[maxn];
LL peak[maxn];
int main(void)
{
	cin.tie(0);std::ios::sync_with_stdio(false);
	LL t;cin>>t;
	while(t--)
	{
		LL n,k;cin>>n>>k;
		//边界
		LL f=1;
	//	memset(a,0,sizeof(a));memset(vis,0,sizeof(vis));memset(peak,0,sizeof(peak));
		for(LL i=1;i<=2*n;i++)
		{
			a[i]=0;vis[i]=0;peak[i]=0;
		}
		for(LL i=1;i<=n;i++) cin>>a[i];

		for(LL i=1;i<n;i++)
		{

			if(i!=1&&a[i]>a[i+1]&&a[i]>a[i-1])
				{
					peak[f++]=i;
					vis[i]=1;
				}
		}
		///<
		LL _l=1;LL ans=0;
		for(LL i=1;i<f;i++)
		{
			LL res=1;
			for(LL j=peak[i]-k+2;j<=peak[i];j++)
				{
					if(vis[j])
					{
						res++;
					}
				}
			if(ans<res)
			{
				ans=res;_l=max((LL)1,peak[i]-k+2);
			}
		}
		if(ans)
		cout<<ans<<' '<<_l<<endl;
		else if(ans==0)
		cout<<1<<1<<endl;
	}

return 0;
}


#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;
const int maxn=2e5+10;
LL a[maxn];
LL vis[maxn];
LL peak[maxn];
int main(void)
{
	cin.tie(0);std::ios::sync_with_stdio(false);
	LL t;cin>>t;
	while(t--)
	{
		LL n,k;cin>>n>>k;
		//边界
		LL f=1;
	//	memset(a,0,sizeof(a));memset(vis,0,sizeof(vis));memset(peak,0,sizeof(peak));
		for(LL i=1;i<=2*n;i++)
		{
			a[i]=0;vis[i]=0;peak[i]=0;
		}
		for(LL i=1;i<=n;i++) cin>>a[i];

		for(LL i=1;i<n;i++)
		{

			if(i!=1&&a[i]>a[i+1]&&a[i]>a[i-1])
				{
					peak[f++]=i;
					vis[i]=1;
				}
		}
		///<
		LL _l=1;LL ans=0;
		for(LL i=1;i<f;i++)
		{
			LL res=1;
			for(LL j=peak[i]-k+2;j<=peak[i];j++)
				{
					if(vis[j])
					{
						res++;
					}
				}
			if(ans<res)
			{
				ans=res;_l=max((LL)1,peak[i]-k+2);
			}
		}
		if(ans)
		cout<<ans<<' '<<_l<<endl;
		else if(ans==0)
		cout<<0<<' '<<0<<endl;
	}

return 0;
}


#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;
const int maxn=2e5+10;
LL a[maxn];
LL vis[maxn];
LL peak[maxn];
int main(void)
{
	cin.tie(0);std::ios::sync_with_stdio(false);
	LL t;cin>>t;
	while(t--)
	{
		LL n,k;cin>>n>>k;
		//边界
		LL f=1;
	//	memset(a,0,sizeof(a));memset(vis,0,sizeof(vis));memset(peak,0,sizeof(peak));
		for(LL i=1;i<=n;i++)
		{
			a[i]=0;vis[i]=0;peak[i]=0;
		}
		for(LL i=1;i<=n;i++) cin>>a[i];

		for(LL i=1;i<n;i++)
		{

			if(i!=1&&a[i]>a[i+1]&&a[i]>a[i-1])
				{
					peak[f++]=i;
					vis[i]=1;
				}
		}
		///<
		LL _l=1;LL ans=0;
		for(LL i=1;i<f;i++)
		{
			LL res=1;
			for(LL j=peak[i]-k+2;j<=peak[i];j++)
				{
					if(vis[j])
					{
						res++;
					}
				}
			if(ans<res)
			{
				ans=res;_l=max((LL)1,peak[i]-k+2);
			}
		}
		cout<<ans<<' '<<_l<<endl;
	}

return 0;
}


/*
    ..Hold on Stan..
    H1s3nb3rg's Here !!
*/
#include <bits/stdc++.h>
using namespace std;
#define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
#define GET_SET_BITS(a) (__builtin_popcount(a))
#define GET_SET_BITSLL(a) ( __builtin_popcountll(a))
#define GET_TRAIL_ZERO(a) (__builtin_ctz(a))
#define GET_LEAD_ZERO(a) (__builtin_clz(a))
#define GET_PARITY(a) (__builtin_parity(a))
#define ff first
#define ss second
#define pp pair
#define ULRED 1000000007
#define MS(x,y) (x-y>0?x-y:y-x)
#define MX(x,y) x>y?x:y
#define MN(x,y) x>y?y:x
#define MXPTR2(a,b,x,y) (x>y?a:b)
#define MXPTR3(a,b,c,x,y,z) (x>y?(x>z?a:c):(y>z?b:c))
#define MX3(a,b,c) (a>b?(a>c?a:c):(b>c?b:c))
#define AEQ(a,b,c) (a==b?1:(a==c?3:(c==b?2:-1)))
#define ENDL "\n"
#define VALL(a) a.begin(),a.end()
typedef vector<ll> vll;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<vector<ll>> v2ll;
#define MP(a,b) make_pair(a,b)
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)
const int MOD = 1e9+7;
#define sz(x) (int)x.size()
const ld PI = acos((ld)-1);
/*------------------------------------------------------------------*/

int main(){
    FAST_IO;
    ll tc;
    cin>>tc;
    while(tc--){
        ll n,k;
        cin>>n>>k;
        vll v(n,0);
        vll peak;
        for(ll i=0;i<n;i++)
            cin>>v[i];
        for(ll i=1;i<n-1;i++)
        {
            if(v[i-1]<v[i] && v[i]>v[i+1]){
                peak.push_back(i);
                //v[i]=-1;
                i++;
            }
        }
        ll sz=-1;
        ll le=0;
        for(ll i=0;i<n;i++){
            ll st=i;
            ll ed=i+k-1;
            ll cr=0;
            if(ed>=n)
                break;
            ll hi=lower_bound(VALL(peak),ed)-peak.begin()-1;
            ll lo=lower_bound(VALL(peak),st)-peak.begin();
            if(hi<0)
                continue;
            if(peak[hi]>=ed)
                hi--;
            if(hi<0)
                continue;
            cr=hi-lo+1;
            if(cr>sz)
            {
                sz=cr;
                le=st;
            }
        }
        cout<<sz+1<<" "<<le+1<<ENDL;
    }
    return 0;
}


/*
    ..Hold on Stan..
    H1s3nb3rg's Here !!
*/
#include <bits/stdc++.h>
using namespace std;
#define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
#define GET_SET_BITS(a) (__builtin_popcount(a))
#define GET_SET_BITSLL(a) ( __builtin_popcountll(a))
#define GET_TRAIL_ZERO(a) (__builtin_ctz(a))
#define GET_LEAD_ZERO(a) (__builtin_clz(a))
#define GET_PARITY(a) (__builtin_parity(a))
#define ff first
#define ss second
#define pp pair
#define ULRED 1000000007
#define MS(x,y) (x-y>0?x-y:y-x)
#define MX(x,y) x>y?x:y
#define MN(x,y) x>y?y:x
#define MXPTR2(a,b,x,y) (x>y?a:b)
#define MXPTR3(a,b,c,x,y,z) (x>y?(x>z?a:c):(y>z?b:c))
#define MX3(a,b,c) (a>b?(a>c?a:c):(b>c?b:c))
#define AEQ(a,b,c) (a==b?1:(a==c?3:(c==b?2:-1)))
#define ENDL "\n"
#define VALL(a) a.begin(),a.end()
typedef vector<ll> vll;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<vector<ll>> v2ll;
#define MP(a,b) make_pair(a,b)
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)
const int MOD = 1e9+7;
#define sz(x) (int)x.size()
const ld PI = acos((ld)-1);
/*------------------------------------------------------------------*/

int main(){
    FAST_IO;
    ll tc;
    cin>>tc;
    while(tc--){
        ll n,k;
        cin>>n>>k;
        vll v(n,0);
        vll peak;
        for(ll i=0;i<n;i++)
            cin>>v[i];
        for(ll i=1;i<n-1;i++)
        {
            if(v[i-1]<v[i] && v[i]>v[i+1]){
                peak.push_back(i);
                //v[i]=-1;
                i++;
            }
        }
        ll sz=-1;
        ll le=0;
        for(ll i=0;i<n;i++){
            ll st=i;
            ll ed=i+k-1;
            ll cr=0;
            if(ed>=n)
                break;
            ll hi=lower_bound(VALL(peak),ed)-peak.begin()-1;
            ll lo=lower_bound(VALL(peak),st)-peak.begin();
            if(peak[hi]>=ed)
                hi--;
            cr=hi-lo+1;
            if(cr>sz)
            {
                sz=cr;
                le=st;
            }
        }
        cout<<sz+1<<" "<<le+1<<ENDL;
    }
    return 0;
}


/*
    ..Hold on Stan..
    H1s3nb3rg's Here !!
*/
#include <bits/stdc++.h>
using namespace std;
#define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
#define GET_SET_BITS(a) (__builtin_popcount(a))
#define GET_SET_BITSLL(a) ( __builtin_popcountll(a))
#define GET_TRAIL_ZERO(a) (__builtin_ctz(a))
#define GET_LEAD_ZERO(a) (__builtin_clz(a))
#define GET_PARITY(a) (__builtin_parity(a))
#define ff first
#define ss second
#define pp pair
#define ULRED 1000000007
#define MS(x,y) (x-y>0?x-y:y-x)
#define MX(x,y) x>y?x:y
#define MN(x,y) x>y?y:x
#define MXPTR2(a,b,x,y) (x>y?a:b)
#define MXPTR3(a,b,c,x,y,z) (x>y?(x>z?a:c):(y>z?b:c))
#define MX3(a,b,c) (a>b?(a>c?a:c):(b>c?b:c))
#define AEQ(a,b,c) (a==b?1:(a==c?3:(c==b?2:-1)))
#define ENDL "\n"
#define VALL(a) a.begin(),a.end()
typedef vector<ll> vll;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<vector<ll>> v2ll;
#define MP(a,b) make_pair(a,b)
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)
const int MOD = 1e9+7;
#define sz(x) (int)x.size()
const ld PI = acos((ld)-1);
/*------------------------------------------------------------------*/

int main(){
    FAST_IO;
    ll tc;
    cin>>tc;
    while(tc--){
        ll n,k;
        cin>>n>>k;
        vll v(n,0);
        vll peak;
        for(ll i=0;i<n;i++)
            cin>>v[i];
        for(ll i=1;i<n-1;i++)
        {
            if(v[i-1]<v[i] && v[i]>v[i+1]){
                peak.push_back(i);
                //v[i]=-1;
                i++;
            }
        }
        ll sz=-1;
        ll le=0;
        for(ll i=0;i<n;i++){
            ll st=i;
            ll ed=i+k-1;
            ll cr=0;
            if(ed>=n)
                break;
            for(auto i:peak)
            {
                if(i<ed && i>st)
                    cr++;
                else
                    break;
            }
            if(cr>sz)
            {
                sz=cr;
                le=st;
            }
        }
        cout<<sz+1<<" "<<le+1<<ENDL;
    }
    return 0;
}


/*
    ..Hold on Stan..
    H1s3nb3rg's Here !!
*/
#include <bits/stdc++.h>
using namespace std;
#define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
#define GET_SET_BITS(a) (__builtin_popcount(a))
#define GET_SET_BITSLL(a) ( __builtin_popcountll(a))
#define GET_TRAIL_ZERO(a) (__builtin_ctz(a))
#define GET_LEAD_ZERO(a) (__builtin_clz(a))
#define GET_PARITY(a) (__builtin_parity(a))
#define ff first
#define ss second
#define pp pair
#define ULRED 1000000007
#define MS(x,y) (x-y>0?x-y:y-x)
#define MX(x,y) x>y?x:y
#define MN(x,y) x>y?y:x
#define MXPTR2(a,b,x,y) (x>y?a:b)
#define MXPTR3(a,b,c,x,y,z) (x>y?(x>z?a:c):(y>z?b:c))
#define MX3(a,b,c) (a>b?(a>c?a:c):(b>c?b:c))
#define AEQ(a,b,c) (a==b?1:(a==c?3:(c==b?2:-1)))
#define ENDL "\n"
#define VALL(a) a.begin(),a.end()
typedef vector<ll> vll;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<vector<ll>> v2ll;
#define MP(a,b) make_pair(a,b)
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)
const int MOD = 1e9+7;
#define sz(x) (int)x.size()
const ld PI = acos((ld)-1);
/*------------------------------------------------------------------*/

int main(){
    FAST_IO;
    ll tc;
    cin>>tc;
    while(tc--){
        ll n,k;
        cin>>n>>k;
        vll v(n,0);
        vll peak;
        for(ll i=0;i<n;i++)
            cin>>v[i];
        for(ll i=1;i<n-1;i++)
        {
            if(v[i-1]<v[i] && v[i]>v[i+1]){
                peak.push_back(i);
                //v[i]=-1;
                i++;
            }
        }
        ll sz=-1;
        ll le=0;
        for(ll i=0;i<n;i++){
            ll st=i;
            ll ed=i+k-1;
            ll cr=0;
            if(ed>=n)
                break;
            for(auto i:peak)
            {
                if(i<=st)
                    continue;
                if(i<ed && i>st)
                    cr++;
                else
                    break;
            }
            if(cr>sz)
            {
                sz=cr;
                le=st;
            }
        }
        cout<<sz+1<<" "<<le+1<<ENDL;
    }
    return 0;
}


/*
    ..Hold on Stan..
    H1s3nb3rg's Here !!
*/
#include <bits/stdc++.h>
using namespace std;
#define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
#define GET_SET_BITS(a) (__builtin_popcount(a))
#define GET_SET_BITSLL(a) ( __builtin_popcountll(a))
#define GET_TRAIL_ZERO(a) (__builtin_ctz(a))
#define GET_LEAD_ZERO(a) (__builtin_clz(a))
#define GET_PARITY(a) (__builtin_parity(a))
#define ff first
#define ss second
#define pp pair
#define ULRED 1000000007
#define MS(x,y) (x-y>0?x-y:y-x)
#define MX(x,y) x>y?x:y
#define MN(x,y) x>y?y:x
#define MXPTR2(a,b,x,y) (x>y?a:b)
#define MXPTR3(a,b,c,x,y,z) (x>y?(x>z?a:c):(y>z?b:c))
#define MX3(a,b,c) (a>b?(a>c?a:c):(b>c?b:c))
#define AEQ(a,b,c) (a==b?1:(a==c?3:(c==b?2:-1)))
#define ENDL "\n"
#define VALL(a) a.begin(),a.end()
typedef vector<ll> vll;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<vector<ll>> v2ll;
#define MP(a,b) make_pair(a,b)
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)
const int MOD = 1e9+7;
#define sz(x) (int)x.size()
const ld PI = acos((ld)-1);
/*------------------------------------------------------------------*/

int main(){
    FAST_IO;
    ll tc;
    cin>>tc;
    while(tc--){
        ll n,k;
        cin>>n>>k;
        vll v(n,0);
        vll peak;
        for(ll i=0;i<n;i++)
            cin>>v[i];
        for(ll i=1;i<n-1;i++)
        {
            if(v[i-1]<v[i] && v[i]>v[i+1]){
                peak.push_back(i);
                //v[i]=-1;
                i++;
            }
        }
        ll sz=-1;
        ll le=0;
        for(ll i=0;i<n;i++){
            ll st=i;
            ll ed=i+k-1;
            ll cr=0;
            for(auto i:peak)
            {
                if(i<ed && i>st)
                    cr++;
                else
                    break;
            }
            if(cr>sz)
            {
                sz=cr;
                le=st;
            }
        }
        cout<<sz+1<<" "<<le+1<<ENDL;
    }
    return 0;
}


/*
    ..Hold on Stan..
    H1s3nb3rg's Here !!
*/
#include <bits/stdc++.h>
using namespace std;
#define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
#define GET_SET_BITS(a) (__builtin_popcount(a))
#define GET_SET_BITSLL(a) ( __builtin_popcountll(a))
#define GET_TRAIL_ZERO(a) (__builtin_ctz(a))
#define GET_LEAD_ZERO(a) (__builtin_clz(a))
#define GET_PARITY(a) (__builtin_parity(a))
#define ff first
#define ss second
#define pp pair
#define ULRED 1000000007
#define MS(x,y) (x-y>0?x-y:y-x)
#define MX(x,y) x>y?x:y
#define MN(x,y) x>y?y:x
#define MXPTR2(a,b,x,y) (x>y?a:b)
#define MXPTR3(a,b,c,x,y,z) (x>y?(x>z?a:c):(y>z?b:c))
#define MX3(a,b,c) (a>b?(a>c?a:c):(b>c?b:c))
#define AEQ(a,b,c) (a==b?1:(a==c?3:(c==b?2:-1)))
#define ENDL "\n"
#define VALL(a) a.begin(),a.end()
typedef vector<ll> vll;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<vector<ll>> v2ll;
#define MP(a,b) make_pair(a,b)
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)
const int MOD = 1e9+7;
#define sz(x) (int)x.size()
const ld PI = acos((ld)-1);
/*------------------------------------------------------------------*/

int main(){
    FAST_IO;
    ll tc;
    cin>>tc;
    while(tc--){
        ll n,k;
        cin>>n>>k;
        vll v(n,0);
        for(ll i=0;i<n;i++)
            cin>>v[i];
        for(ll i=1;i<n-1;i++)
        {
            if(v[i-1]<v[i] && v[i]>v[i+1]){
                v[i]=-1;
                i++;
            }
        }
        ll lmin=0;
        ll mx=-1;
        for(ll i=0;i<n;i++){
            ll cnt=0;
            for(ll j=0;j<k-1 && i+j<n;j++){
                if(v[i+j]==-1 && i+j<i+k-1 && j!=0)
                    cnt++;
            }
            if(cnt>mx){
                lmin=i;
                mx=cnt;
            }
        }

        cout<<mx+1<<" "<<lmin+1<<ENDL;
    }
    return 0;
}


/*
    ..Hold on Stan..
    H1s3nb3rg's Here !!
*/
#include <bits/stdc++.h>
using namespace std;
#define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
#define GET_SET_BITS(a) (__builtin_popcount(a))
#define GET_SET_BITSLL(a) ( __builtin_popcountll(a))
#define GET_TRAIL_ZERO(a) (__builtin_ctz(a))
#define GET_LEAD_ZERO(a) (__builtin_clz(a))
#define GET_PARITY(a) (__builtin_parity(a))
#define ff first
#define ss second
#define pp pair
#define ULRED 1000000007
#define MS(x,y) (x-y>0?x-y:y-x)
#define MX(x,y) x>y?x:y
#define MN(x,y) x>y?y:x
#define MXPTR2(a,b,x,y) (x>y?a:b)
#define MXPTR3(a,b,c,x,y,z) (x>y?(x>z?a:c):(y>z?b:c))
#define MX3(a,b,c) (a>b?(a>c?a:c):(b>c?b:c))
#define AEQ(a,b,c) (a==b?1:(a==c?3:(c==b?2:-1)))
#define ENDL "\n"
#define VALL(a) a.begin(),a.end()
typedef vector<ll> vll;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<vector<ll>> v2ll;
#define MP(a,b) make_pair(a,b)
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)
const int MOD = 1e9+7;
#define sz(x) (int)x.size()
const ld PI = acos((ld)-1);
/*------------------------------------------------------------------*/

int main(){
    FAST_IO;
    ll tc;
    cin>>tc;
    while(tc--){
        ll n,k;
        cin>>n>>k;
        vll v(n,0);
        vll psum(n,0);
        vll peak;
        for(ll i=0;i<n;i++)
            cin>>v[i];
        for(ll i=1;i<n-1;i++)
        {
            if(v[i-1]<v[i] && v[i]>v[i+1]){
                peak.push_back(i);
                //v[i]=-1;
                psum[i]=1;
                i++;
            }
        }
        for(ll i=1;i<n;i++)
            psum[i]=psum[i-1]+psum[i];
        ll mx=-1;
        ll lp=0;
        for(ll i=0;i<n-k+1;i++){
            ll len=psum[k+i-2]-psum[i];
            if(len>mx){
                mx=len;
                lp=i;
            }
        }
        cout<<mx+1<<" "<<lp+1<<ENDL;
    }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <math.h>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#define INF_MAX 2147483647
#define INF_MIN -2147483647
#define INF_LL 9223372036854775807LL
#define INF 2000000000
#define PI acos(-1.0)
#define inf INT_MAX
#define llu unsigned long long int
#define all(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define si(n) scanf("%d",&n)
#define slli(n) scanf("%lld",&n);
#define ss(n) scanf("%s",n);
using namespace std;
typedef long long int LL;
std::vector<int > adjList[123460];
bool marked[123460];
int dist[123460];

int dfs(int curr_node , int parent ,  int d){
	std::vector<int >::iterator it = adjList[curr_node].begin();
	int ret = -1 , child;
	dist[curr_node] = d;
	while(it!=adjList[curr_node].end()){
		if((*it)!=parent){
			child = dfs((*it) , curr_node , d + 1);
			if(child!=-1){
				if(ret==-1)
					ret = 0;
				ret = ret + 2 + child;
			}
		}
		it++;
	}
	if(marked[curr_node]==true && ret==-1){
		// dist[curr_node] = d;
		ret = 0;
	}
	// cout << curr_node << "$" << d << endl;
	return ret;
}

int main(){
int V , r , u , v;
si(V);si(r);

memset(marked , false , sizeof(marked));
for(int i=1;i<=V-1;i++){
	si(u);si(v);
	adjList[u].pb(v);
	adjList[v].pb(u);
}
for(int i=1;i<=r;i++){
	si(u);
	marked[u] = true;
}
if(r!=1)
{
int twos;
for(int i=1;i<=V;i++){
	if(marked[i] == true){
		twos =  dfs(i , i , 0);
		break;
}
}

int ans_dist = 0;
int ans_node , x;

for(int i=1;i<=V;i++)
{
	if(dist[i] > ans_dist && marked[i]==true){
		ans_dist = dist[i];
		ans_node = i;
	}
}

for(int i=0;i<V+3;i++)
	dist[i] = 0;
dfs(ans_node , ans_node , 0);

ans_dist= 0;
for(int i=1;i<=V;i++){
	if(dist[i] > ans_dist && marked[i]==true){
		ans_dist = dist[i];
		ans_node = i;
	}
}

if(r!=1){
cout << ans_node << endl;
cout << (twos) - ans_dist << endl;
}
}
else
{
	for(int i=1;i<=V;i++)
	{
		if(marked[i]==true){
			cout << i << endl;
			break;
		}
	}
	cout << "0" << endl;
}

return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int > pii;
typedef pair<int,pii > piii;
typedef vector<int>     VI;
//input
#define sc1(x) scanf("%d",&x);
#define sc2(x,y) scanf("%d%d",&x,&y);
#define sc3(x,y,z) scanf("%d%d%d",&x,&y,&z);

/*
#define sc1(x) scanf("%lld",&x);
#define sc2(x,y) scanf("%lld%lld",&x,&y);
#define sc3(x,y,z) scanf("%lld%lld%lld",&x,&y,&z);
*/

#define pb push_back
#define mp make_pair
#define ini(x,val) memset(x,val,sizeof(x));

#define fs first
#define sc second

//some constants
#define MOD 1000000007
#define inf 999999999
#define linf 99999999999999999ll	//long long inf
#define PI 3.1415926535897932384626
const double eps=0.000000000000001 ;

#define gcd __gcd
#define tr(container, it)  for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define PrintCont(cont) {cout<<("\n----------------\n");\
for(typeof(cont.begin()) it = cont.begin();it!=cont.end();++it) cout<<*it<<" ";cout<<("\n----------------\n");}
#define all(v) v.begin(),v.end()
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)

#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";

#define LIM 123460
VI g[LIM];
int marked[LIM],use[LIM],lev[LIM],lev2[LIM];

int  DFS(int src,int par,int l)
{
	lev[src]=l;
	int x=marked[src];
	for(int i=0;i<g[src].size();++i)
	{
		if(g[src][i]!=par)
		{
			x+=DFS(g[src][i],src,l+1);
		}
	}
	if(x)
		use[src]=1;
	return x;
}
int mxxx;
void DFS2(int src,int par,int l)
{

	lev2[src] = l;
	mxxx = max(mxxx,l);
	for(int i=0;i<g[src].size();++i)
	{
		if(g[src][i]!=par && use[g[src][i]])
		{
			DFS2(g[src][i],src,l+1);
		}
	}
}
int main()
{
	int n,m,i,j;sc2(n,m);
	for(i=0;i<n-1;++i)
	{
		int u,v;sc2(u,v);
		g[u].pb(v);
		g[v].pb(u);
	}
	int root ;
	for(i=0;i<m;++i)
	{
		int x;sc1(x);
		root = x;
		marked[x]=1;
	}
	DFS(root,-1,0);
	int mx=-1,node=0,ans;
	for(i=1;i<=n;++i)
	{
		if(use[i]&&lev[i]>mx)
		{
			mx = lev[i];
			node = i;
		}
	}
	mxxx = -1;
	DFS2(node,-1,0);
	for(i=1;i<=n;++i)
	{
		if(use[i]&&lev2[i]==mxxx)
		{
			ans = i;break;
		}
	}
	ans = min(ans,node);
	int yo=0;
	for(i=1;i<=n;++i)
	{
		if(use[i])
		{
			for(j=0;j<g[i].size();++j)
			{
				if(use[g[i][j]])yo++;
			}
		}
	}
	yo/=2;
	printf("%d\n%d\n",ans,2*yo-mxxx);

	return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define INF 1000000000000000
#define pi 3.1415926535
using namespace std;
queue<ll>q;
ll int c[2],flag=0,x,dis[200000],y,m,n,i,x1,e[200000],in[200000],vis[200000],arr[200000];
vector<ll>v[200000];
void dfs(ll u)
{
	vis[u]=1;
	vector<ll>::iterator it;
	for(it=v[u].begin();it!=v[u].end();it++)
	{
		if(vis[*it]==0&&in[*it]>=0)
		{
		//	printf("%lld %lld\n",u,*it);
			dis[*it]=dis[u]+1;
			dfs(*it);
		}
	}
}
int main()
{
	cin>>n>>m;
	for(i=0;i<n-1;i++)
	{
		cin>>x>>y;
		v[x].pb(y);
		v[y].pb(x);
		in[x]++;in[y]++;
	}
	for(i=0;i<m;i++)
	{
		cin>>x;
		e[x]=1;
	}
	for(i=1;i<=n;i++)
	{
		if(e[i]!=1&&in[i]==1)
		{
			in[i]=-1;
			q.push(i);
		}
	}

	while(!q.empty())
	{
		ll u=q.front();
	//	printf("%lld ",u);
		q.pop();
		vector<ll>::iterator it;
		for(it=v[u].begin();it!=v[u].end();it++)
		{
			in[*it]--;
			if(e[*it]==0&&in[*it]==1)
			{
				in[*it]=-1;
				q.push(*it);
			}
		}
	}
	//printf("\n---------------\n");
	x=0;
	//for(i=1;i<=n;i++)
	//{
	//	printf("%lld %lld %lld\n",i,e[i],in[i]);
	//}
	for(i=1;i<=n;i++)
	{
		if(in[i]>=0&&e[i]==1&&flag==0)
		{
			flag=1;
//			printf("dfs %lld\n",i);
			dfs(i);
		}
		if(in[i]>=0)
		{
			x++;
		}
	}

	//if(n==256)
	{
		//printf("x: :: %lld \n",x);
	}
//	for(i=1;i<=n;i++)
//	printf("%lld %lld\n",i,dis[i]);
	ll d=-1,vertex=-1;
	for(i=1;i<=n;i++)
	{
		if(in[i]>=0)
		{
			if(dis[i]>d)
			{
				vertex=i;
				d=dis[i];
			}
		}
	}
	memset(dis,0,sizeof(dis));
	memset(vis,0,sizeof(vis));
	dfs(vertex);
	d=-1;ll vertex1=vertex;
	for(i=1;i<=n;i++)
	{
		//printf("")
		if(in[i]>=0)
		{
			if(dis[i]>d)
			{
				vertex1=i;
				d=dis[i];
			}
		}
	}
//	printf("%lld\n",d);
if(vertex1!=-1)
vertex=min(vertex,vertex1);
	printf("%lld\n%lld\n",vertex,2*(x-1)-d);
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define INF 1000000000000000
#define pi 3.1415926535
using namespace std;
queue<ll>q;
ll int c[2],flag=0,x,dis[200000],y,m,n,i,x1,e[200000],in[200000],vis[200000],arr[200000];
vector<ll>v[200000];
void dfs(ll u)
{
	vis[u]=1;
	vector<ll>::iterator it;
	for(it=v[u].begin();it!=v[u].end();it++)
	{
		if(vis[*it]==0&&in[*it]>0)
		{
		//	printf("%lld %lld\n",u,*it);
			dis[*it]=dis[u]+1;
			dfs(*it);
		}
	}
}
int main()
{
	cin>>n>>m;
	for(i=0;i<n-1;i++)
	{
		cin>>x>>y;
		v[x].pb(y);
		v[y].pb(x);
		in[x]++;in[y]++;
	}
	for(i=0;i<m;i++)
	{
		cin>>x;
		e[x]=1;
	}
	for(i=1;i<=n;i++)
	{
		if(e[i]!=1&&in[i]==1)
		{
			in[i]=-1;
			q.push(i);
		}
	}
	while(!q.empty())
	{
		ll u=q.front();
		q.pop();
		vector<ll>::iterator it;
		for(it=v[u].begin();it!=v[u].end();it++)
		{
			in[*it]--;
			if(e[*it]==0&&in[*it]==1)
			{
				in[*it]=-1;
				q.push(*it);
			}
		}
	}
	x=0;
	//for(i=1;i<=n;i++)
	//{
	//	printf("%lld %lld %lld\n",i,e[i],in[i]);
	//}
	for(i=1;i<=n;i++)
	{
		if(in[i]!=-1&&e[i]==1&&flag==0)
		{
			flag=1;
//			printf("dfs %lld\n",i);
			dfs(i);
		}
		if(in[i]>0)
		{
			x++;
		}
	}
	if(n==256)
	{
		cout<<"x : "<<x<<endl;
	}
//	for(i=1;i<=n;i++)
//	printf("%lld %lld\n",i,dis[i]);
	ll d=-1,vertex=-1;
	for(i=1;i<=n;i++)
	{
		if(in[i]>0)
		{
			if(dis[i]>d)
			{
				vertex=i;
				d=dis[i];
			}
		}
	}
	memset(dis,0,sizeof(dis));
	memset(vis,0,sizeof(vis));
	dfs(vertex);
	d=-1;ll vertex1=vertex;

	for(i=1;i<=n;i++)
	{
		if(in[i]>0)
		{
			if(dis[i]>d)
			{
				vertex1=i;
				d=dis[i];
			}
		}
	}
//	printf("%lld\n",d);
if(vertex1!=-1)
vertex=min(vertex,vertex1);
	printf("%lld\n%lld\n",vertex,2*(x-1)-d);
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define INF 1000000000000000
#define pi 3.1415926535
using namespace std;
queue<ll>q;
ll int c[2],flag=0,x,dis[200000],y,m,n,i,x1,e[200000],in[200000],vis[200000],arr[200000];
vector<ll>v[200000];
void dfs(ll u)
{
	vis[u]=1;
	vector<ll>::iterator it;
	for(it=v[u].begin();it!=v[u].end();it++)
	{
		if(vis[*it]==0&&in[*it]>=0)
		{
		//	printf("%lld %lld\n",u,*it);
			dis[*it]=dis[u]+1;
			dfs(*it);
		}
	}
}
int main()
{
	cin>>n>>m;
	for(i=0;i<n-1;i++)
	{
		cin>>x>>y;
		v[x].pb(y);
		v[y].pb(x);
		in[x]++;in[y]++;
	}
	for(i=0;i<m;i++)
	{
		cin>>x;
		e[x]=1;
	}
	for(i=1;i<=n;i++)
	{
		if(e[i]!=1&&in[i]==1)
		{
			in[i]=-1;
			q.push(i);
		}
	}
	while(!q.empty())
	{
		ll u=q.front();
		q.pop();
		vector<ll>::iterator it;
		for(it=v[u].begin();it!=v[u].end();it++)
		{
			in[*it]--;
			if(e[*it]==0&&in[*it]==1)
			{
				in[*it]=-1;
				q.push(*it);
			}
		}
	}
	x=0;
	//for(i=1;i<=n;i++)
	//{
	//	printf("%lld %lld %lld\n",i,e[i],in[i]);
	//}
	for(i=1;i<=n;i++)
	{
		if(in[i]!=-1&&e[i]==1&&flag==0)
		{
			flag=1;
//			printf("dfs %lld\n",i);
			dfs(i);
		}
		if(in[i]!=-1)
		{
			x++;
		}
	}
	if(n==256)
	{
		printf("x: :: %lld \n",x);
	}
//	for(i=1;i<=n;i++)
//	printf("%lld %lld\n",i,dis[i]);
	ll d=-1,vertex=-1;
	for(i=1;i<=n;i++)
	{
		if(in[i]!=-1)
		{
			if(dis[i]>d)
			{
				vertex=i;
				d=dis[i];
			}
		}
	}
	memset(dis,0,sizeof(dis));
	memset(vis,0,sizeof(vis));
	dfs(vertex);
	d=0;ll vertex1=vertex;
	for(i=1;i<=n;i++)
	{
		if(in[i]!=-1)
		{
			if(dis[i]>d)
			{
				vertex1=i;
				d=dis[i];
			}
		}
	}
//	printf("%lld\n",d);
if(vertex1!=-1)
vertex=min(vertex,vertex1);
	printf("%lld\n%lld\n",vertex,2*(x-1)-d);
	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cstring>
#include <string>
#include <set>
#include <cmath>
#include <map>
#include <queue>
#include <sstream>
#include <fstream>
using namespace std;
#define rep(i, a, b) for(int i=(int)a; i<=(int)b; i++)
#define repd(i, a, b) for(int i=(int)a; i >=(int)b; i--)
#define ull long long
#define pb push_back
#define mp make_pair
#define nmax 123490
vector<int > graph[nmax];
bool attacked[nmax], visited[nmax];

int n, m, parent[nmax];
int dist, last;
void dfs(int u, int depth) {

    if(attacked[u]) {

        if(dist < depth) {
            dist = depth;
            last = u;
        }else {
            if(dist == depth) {
                last = min(last, u);
            }
        }
    }

    visited[u] = true;
    rep(i, 0, graph[u].size() - 1) {
        int v = graph[u][i];
        if(!visited[v]) {
            parent[v] = u;
            dfs(v, depth + 1);
        }
    }
}

vector<int > path;

void augment_path(int v) {
    visited[v] = true;
    path.pb(v);
    if(parent[v] == -1) return ;
    augment_path(parent[v]);
}

int all = 0;
bool dfs2(int u) {

    visited[u] = true;
    int ans = 0;
    rep(i, 0, graph[u].size() - 1) {
        int v = graph[u][i];
        if(!visited[v]) {
            ans |= dfs2(v);
        }
    }

    if(attacked[u]) ans = 1;
    all += ans;
    return ans;
}

int main() {

    cin >> n >> m;
    int u, v;
    rep(i, 1, n - 1) {
        cin >> u >> v;
        graph[u].pb(v);
        graph[v].pb(u);
    }
    int tmp = nmax;
    rep(i, 1, m) {
        cin >> u;
        attacked[u] = true;
        tmp = min(tmp, u);
    }
    dist = -1;
    dfs(tmp, 0);
    tmp = last;
    memset(parent, -1, sizeof parent);
    memset(visited, 0, sizeof visited);
    dist = -1;
    dfs(last, 0);
    cout << min(tmp, last) << endl;
    memset(visited, 0, sizeof visited);
    dfs2(tmp);
    cout << (all * 2) - 2 - dist << endl;

    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cstring>
#include <string>
#include <set>
#include <cmath>
#include <map>
#include <queue>
#include <sstream>
#include <fstream>
using namespace std;
#define rep(i, a, b) for(int i=(int)a; i<=(int)b; i++)
#define repd(i, a, b) for(int i=(int)a; i >=(int)b; i--)
#define ull long long
#define pb push_back
#define mp make_pair
#define nmax 123490
vector<int > graph[nmax];
bool attacked[nmax], visited[nmax];

int n, m;
int dist, last;
void dfs(int u, int depth) {

    if(attacked[u]) {

        if(dist < depth) {
            dist = depth;
            last = u;
        }else {
            if(dist == depth) {
                last = min(last, u);
            }
        }
    }
    visited[u] = true;
    rep(i, 0, graph[u].size() - 1) {
        int v = graph[u][i];
        if(!visited[v]) {
            dfs(v, depth + 1);
        }
    }
}

int all = 0;
bool dfs2(int u) {

    visited[u] = true;
    int ans = 0;
    rep(i, 0, graph[u].size() - 1) {
        int v = graph[u][i];
        if(!visited[v]) {
            ans |= dfs2(v);
        }
    }

    if(attacked[u]) ans = 1;
    all += ans;
    return ans;
}

int main() {

    cin >> n >> m;
    int u, v;
    rep(i, 1, n - 1) {
        cin >> u >> v;
        graph[u].pb(v);
        graph[v].pb(u);
    }
    int tmp = nmax;
    rep(i, 1, m) {
        cin >> u;
        attacked[u] = true;
        tmp = u;
    }
    dist = -1;
    dfs(tmp, 0);
    tmp = last;
    memset(visited, 0, sizeof visited);
    dist = -1;
    dfs(last, 0);
    cout << min(tmp, last) << endl;
    memset(visited, 0, sizeof visited);
    dfs2(tmp);
    all --;
    cout << (all * 2) - dist << endl;

    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cstring>
#include <string>
#include <set>
#include <cmath>
#include <map>
#include <queue>
#include <sstream>
#include <fstream>
using namespace std;
#define rep(i, a, b) for(int i=(int)a; i<=(int)b; i++)
#define repd(i, a, b) for(int i=(int)a; i >=(int)b; i--)
#define ull long long
#define pb push_back
#define mp make_pair
#define nmax 123490
vector<int > graph[nmax];
bool attacked[nmax], visited[nmax];

int n, m, parent[nmax];
int dist, last;
void dfs(int u, int depth) {

    if(attacked[u]) {
        if(dist < depth) {
            dist = depth;
            last = u;
        }else {
            if(dist == depth) {
                last = min(last, u);
            }
        }
    }

    visited[u] = true;
    rep(i, 0, graph[u].size() - 1) {
        int v = graph[u][i];
        if(!visited[v]) {
            parent[v] = u;
            dfs(v, depth + 1);
        }
    }
}

vector<int > path;

void augment_path(int v) {
    visited[v] = true;
    path.pb(v);
    if(parent[v] == -1) return ;
    augment_path(parent[v]);
}

int sz = 0, sz_ans = 0;

void dfs1(int u) {
    if(attacked[u]) {
        sz_ans = sz;
    }
    visited[u] = true;
    rep(i, 0, graph[u].size() - 1) {
        int v = graph[u][i];
        if(!visited[v]) {
            sz ++;
            dfs1(v);
            sz = sz_ans;
        }
    }
}

int main() {

    cin >> n >> m;
    int u, v;
    rep(i, 1, n - 1) {
        cin >> u >> v;
        graph[u].pb(v);
        graph[v].pb(u);
    }
    int tmp = nmax;
    rep(i, 1, m) {
        cin >> u;
        attacked[u] = true;
        tmp = min(tmp, u);
    }
    dist = -1;
    dfs(tmp, 0);
    tmp = last;
    memset(parent, -1, sizeof parent);
    memset(visited, 0, sizeof visited);
    dist = -1;
    dfs(last, 0);
    cout << min(tmp, last) << endl;
    memset(visited, 0, sizeof visited);

    augment_path(last);
    int res = 0;
    rep(i, 0, path.size() - 1) {
        u = path[i];
        sz = 0; sz_ans = 0;
        dfs1(u);
        res += sz_ans;
    }
    cout << res * 2 + dist << endl;
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cstring>
#include <string>
#include <set>
#include <cmath>
#include <map>
#include <queue>
#include <sstream>
#include <fstream>
using namespace std;
#define rep(i, a, b) for(int i=(int)a; i<=(int)b; i++)
#define repd(i, a, b) for(int i=(int)a; i >=(int)b; i--)
#define ull long long
#define pb push_back
#define mp make_pair
#define nmax 123490
vector<int > graph[nmax];
bool attacked[nmax], visited[nmax];

int n, m, parent[nmax];
int dist, last;
void dfs(int u, int depth) {

    if(attacked[u]) {
        if(dist < depth) {
            dist = depth;
            last = u;
        }else {
            if(dist == depth) {
                last = min(last, u);
            }
        }
    }

    visited[u] = true;
    rep(i, 0, graph[u].size() - 1) {
        int v = graph[u][i];
        if(!visited[v]) {
            parent[v] = u;
            dfs(v, depth + 1);
        }
    }
}

vector<int > path;

void augment_path(int v) {
    visited[v] = true;
    path.pb(v);
    if(parent[v] == -1) return ;
    augment_path(parent[v]);
}

int sz = 0, sz_ans = 0;
void dfs1(int u) {
    if(attacked[u]) {
        sz_ans = sz;
    }
    visited[u] = true;
    rep(i, 0, graph[u].size() - 1) {
        int v = graph[u][i];
        if(!visited[v]) {
            sz ++;
            dfs1(v);
        }
    }
}

int main() {

    cin >> n >> m;
    int u, v;
    rep(i, 1, n - 1) {
        cin >> u >> v;
        graph[u].pb(v);
        graph[v].pb(u);
    }
    int tmp = nmax;
    rep(i, 1, m) {
        cin >> u;
        attacked[u] = true;
        tmp = min(tmp, u);
    }
    dist = -1;
    dfs(tmp, 0);
    tmp = last;
    memset(parent, -1, sizeof parent);
    memset(visited, 0, sizeof visited);
    dist = -1;
    dfs(last, 0);
    cout << min(tmp, last) << endl;
    memset(visited, 0, sizeof visited);
    augment_path(last);
    int res = 0;
    rep(i, 0, path.size() - 1) {
        u = path[i];
        sz = 0; sz_ans = 0;
        dfs1(u);
        res += sz_ans;
    }
    cout << res * 2 + dist << endl;
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cstring>
#include <string>
#include <set>
#include <cmath>
#include <map>
#include <queue>
#include <sstream>
#include <fstream>
using namespace std;
#define rep(i, a, b) for(int i=(int)a; i<=(int)b; i++)
#define repd(i, a, b) for(int i=(int)a; i >=(int)b; i--)
#define ull long long
#define pb push_back
#define mp make_pair
#define nmax 123490
vector<int > graph[nmax];
bool attacked[nmax], visited[nmax];

int n, m, parent[nmax];
int dist, last;
void dfs(int u, int depth) {

    if(attacked[u]) {

        if(dist < depth) {
            dist = depth;
            last = u;
        }else {
            if(dist == depth) {
                last = min(last, u);
            }
        }
    }

    visited[u] = true;
    rep(i, 0, graph[u].size() - 1) {
        int v = graph[u][i];
        if(!visited[v]) {
            parent[v] = u;
            dfs(v, depth + 1);
        }
    }
}

vector<int > path;

void augment_path(int v) {
    visited[v] = true;
    path.pb(v);
    if(parent[v] == -1) return ;
    augment_path(parent[v]);
}

int all = 0;
bool dfs2(int u) {

    visited[u] = true;
    int ans = 0;
    rep(i, 0, graph[u].size() - 1) {
        int v = graph[u][i];
        if(!visited[v]) {
            ans |= dfs2(v);
        }
    }

    if(attacked[u]) ans = 1;
    all += ans;
    return ans;
}

int main() {

    cin >> n >> m;
    int u, v;
    rep(i, 1, n - 1) {
        cin >> u >> v;
        graph[u].pb(v);
        graph[v].pb(u);
    }
    int tmp = nmax;
    rep(i, 1, m) {
        cin >> u;
        attacked[u] = true;
        tmp = min(tmp, u);
    }
    dist = -1;
    dfs(tmp, 0);
    tmp = last;
    memset(parent, -1, sizeof parent);
    memset(visited, 0, sizeof visited);
    dist = -1;
    dfs(last, 0);
    cout << min(tmp, last) << endl;
    memset(visited, 0, sizeof visited);
    dfs2(tmp);
    all --;
    cout << (all * 2) - dist << endl;

    return 0;
}


#include <iostream>
#include <list>
#include <vector>
#include <string.h>
#include <limits.h>

class Node {
	private:
		std::list<Node *> edges;
		int id;
		bool humans;

	public:
		Node(int id);
		void placeHumans() { humans = true; }
		bool containsHumans() { return humans; }
		bool isLeaf() { return edges.size() <= 1; }
		int getId() { return id; }
		void addEdge(Node *node);
		void pruneEmptyLeaves(Node *parent);
		void distanceBetweenTwoDeepestLeaves(int *max_depth, int *deepest_leaf_id, int *distance_between_deepest, int *leaf1, int *leaf2, Node *parent);
		int traverseLength(Node *parent);
};

Node::Node(int id) {
	this->id = id;
	humans = false;
}

void
Node::addEdge(Node *node) {
	edges.push_back(node);
}

static int min(int a, int b) {
	return (a < b) ? a : b;
}

static int max(int a, int b) {
	return (a > b) ? a : b;
}

void
Node::distanceBetweenTwoDeepestLeaves(int *max_depth_r, int *deepest_leaf_id_r,
		int *distance_between_deepest_r, int *leaf1_r, int *leaf2_r,
		Node *parent) {
	if (parent && this->isLeaf()) {
		*max_depth_r = 0;
		*deepest_leaf_id_r = id;
		*distance_between_deepest_r = 0;
		*leaf1_r = *leaf2_r = id;
	}
	else {
		int max_depths[2];
		int deepest_leaves[2];
		int num_deep_leaves = 0;
		int max_dist = INT_MIN;
		int max_dist_leaf1 = -1, max_dist_leaf2 = -1;

		for (std::list<Node *>::iterator it = edges.begin(); it != edges.end(); ++it) {
			int max_depth, deepest_leaf_id, distance_between_deepest, leaf1, leaf2;
			if (parent && (*it)->getId() == parent->getId())
				continue;

			(*it)->distanceBetweenTwoDeepestLeaves(&max_depth, &deepest_leaf_id, &distance_between_deepest, &leaf1, &leaf2, this);

			if (distance_between_deepest > max_dist ||
					(distance_between_deepest == max_dist && min(leaf1, leaf2) < min(max_dist_leaf1, max_dist_leaf2))) {
				max_dist = distance_between_deepest;
				if (leaf1 > leaf2) {
					std::swap(leaf1, leaf2);
				}
				max_dist_leaf1 = leaf1;
				max_dist_leaf2 = leaf2;
			}

			int insert_pos;
			max_depth++;

			for (insert_pos = 0; insert_pos < num_deep_leaves; ++insert_pos) {
				if (max_depth > max_depths[insert_pos] || (max_depth == max_depths[insert_pos] && deepest_leaf_id < deepest_leaves[insert_pos]))
					break;
			}
			if (insert_pos < 2) {
				memmove(max_depths + insert_pos + 1, max_depths + insert_pos, sizeof(int) * (1 - insert_pos));
				memmove(deepest_leaves + insert_pos + 1, deepest_leaves + insert_pos, sizeof(int) * (1 - insert_pos));
				max_depths[insert_pos] = max_depth;
				deepest_leaves[insert_pos] = deepest_leaf_id;
				if (num_deep_leaves < 2)
					num_deep_leaves++;
			}
		}

		int depth_sum = 0;
		for (int i = 0; i < num_deep_leaves; ++i) {
			depth_sum += max_depths[i];
		}

		if (num_deep_leaves == 2 && (depth_sum > max_dist ||
					(depth_sum == max_dist && min(deepest_leaves[0], deepest_leaves[1]) < min(max_dist_leaf1, max_dist_leaf2)))) {
			*max_depth_r = max_depths[0];
			*deepest_leaf_id_r = deepest_leaves[0];
			*distance_between_deepest_r = depth_sum;
			*leaf1_r = deepest_leaves[0];
			*leaf2_r = deepest_leaves[1];
		}
		else {
			if (!parent && isLeaf() && (max_depths[0] > max_dist ||
						(max_depths[0] == max_dist &&
						 (this->id < min(max_dist_leaf1, max_dist_leaf2) || deepest_leaves[0] < min(max_dist_leaf1, max_dist_leaf2))))) {
				*max_depth_r = max_depths[0];
				*deepest_leaf_id_r = deepest_leaves[0];
				*distance_between_deepest_r = max_depths[0];
				*leaf1_r = min(this->id, deepest_leaves[0]);
				*leaf2_r = max(this->id, deepest_leaves[0]);
			}
			else {
				*max_depth_r = max_depths[0];
				*deepest_leaf_id_r = deepest_leaves[0];
				*distance_between_deepest_r = max_dist;
				*leaf1_r = max_dist_leaf1;
				*leaf2_r = max_dist_leaf2;
			}
		}
	}
}

int
Node::traverseLength(Node *parent) {
	int total = 0;
	for (std::list<Node *>::iterator it = edges.begin(); it != edges.end(); ++it) {
		if (parent && (*it)->getId() == parent->getId())
			continue;

		/* We'll need to follow this edge, traverse the subtree
		 * and then follow the edge back up */
		total += 2 + (*it)->traverseLength(this);
	}
	return total;
}

void
Node::pruneEmptyLeaves(Node *parent) {
	std::list<Node *> new_edges;
	for (std::list<Node *>::iterator it = edges.begin(); it != edges.end(); ++it) {
		bool keep = true;
		if (!(parent && (*it)->getId() == parent->getId())) {
			if ((*it)->isLeaf()) {
				if (!(*it)->containsHumans()) {
					keep = false;
					//std::cerr << "pruning node " << (*it)->getId() << std::endl;
				}
			}
			else {
				(*it)->pruneEmptyLeaves(this);
			}
		}
		if (keep)
			new_edges.push_back(*it);
	}
	edges = new_edges;
}

int main(int argc, char **argv) {
	int num_cities, num_cities_attacked;
	std::vector<Node *> tree;

	std::cin >> num_cities >> num_cities_attacked;

	for (int i = 0; i < num_cities; ++i) {
		tree.push_back(new Node(i + 1));
	}

	for (int i = 0; i < num_cities - 1; ++i) {
		int node1, node2;

		std::cin >> node1 >> node2;

		tree[node1 - 1]->addEdge(tree[node2 - 1]);
		tree[node2 - 1]->addEdge(tree[node1 - 1]);
	}

	int root = -1;
	for (int i = 0; i < num_cities_attacked; ++i) {
		int node;
		std::cin >> node;
		tree[node - 1]->placeHumans();
		if (root < 0)
			root = node;
	}

	/* The root is an arbitrary node with humans on it */
	Node *root_node = tree[root - 1];
	root_node->pruneEmptyLeaves(NULL);

	int trav_len = root_node->traverseLength(NULL);

	int max_depth = 0;
	int deepest_leaf_id = -1;
	int distance_between_deepest = -1;
	int leaf1 = -1, leaf2 = -1;

	root_node->distanceBetweenTwoDeepestLeaves(&max_depth, &deepest_leaf_id,
			&distance_between_deepest, &leaf1, &leaf2, NULL);

	int shortest_path = trav_len - distance_between_deepest;
	int start_leaf = leaf1;
	if (leaf1 > leaf2)
		start_leaf = leaf2;

	//std::cerr << leaf1 << " " << leaf2 << " " << trav_len << " " << distance_between_deepest << std::endl;

	std::cout << start_leaf << std::endl << shortest_path << std::endl;

	for (int i = 0; i < tree.size(); ++i)
		delete tree[i];

	return 0;
}


#include <iostream>
#include <list>
#include <vector>
#include <string.h>
#include <limits.h>

class Node {
	private:
		std::list<Node *> edges;
		int id;
		bool humans;

	public:
		Node(int id);
		void placeHumans() { humans = true; }
		bool containsHumans() { return humans; }
		bool isLeaf() { return edges.size() <= 1; }
		int getId() { return id; }
		void addEdge(Node *node);
		void pruneEmptyLeaves(Node *parent);
		void distanceBetweenTwoDeepestLeaves(int *max_depth, int *deepest_leaf_id, int *distance_between_deepest, int *leaf1, int *leaf2, Node *parent);
		int traverseLength(Node *parent);
};

Node::Node(int id) {
	this->id = id;
	humans = false;
}

void
Node::addEdge(Node *node) {
	edges.push_back(node);
}

static int min(int a, int b) {
	return (a < b) ? a : b;
}

static int max(int a, int b) {
	return (a > b) ? a : b;
}

void
Node::distanceBetweenTwoDeepestLeaves(int *max_depth_r, int *deepest_leaf_id_r,
		int *distance_between_deepest_r, int *leaf1_r, int *leaf2_r,
		Node *parent) {
	if (parent && this->isLeaf()) {
		*max_depth_r = 0;
		*deepest_leaf_id_r = id;
		*distance_between_deepest_r = 0;
		*leaf1_r = *leaf2_r = id;
	}
	else {
		int max_depths[2];
		int deepest_leaves[2];
		int num_deep_leaves = 0;
		int max_dist = INT_MIN;
		int max_dist_leaf1 = -1, max_dist_leaf2 = -1;

		for (std::list<Node *>::iterator it = edges.begin(); it != edges.end(); ++it) {
			int max_depth, deepest_leaf_id, distance_between_deepest, leaf1, leaf2;
			if (parent && (*it)->getId() == parent->getId())
				continue;

			(*it)->distanceBetweenTwoDeepestLeaves(&max_depth, &deepest_leaf_id, &distance_between_deepest, &leaf1, &leaf2, this);

			if (distance_between_deepest > max_dist ||
					distance_between_deepest == max_dist && leaf1 < max_dist_leaf1) {
				max_dist = distance_between_deepest;
				if (leaf1 > leaf2) {
					std::swap(leaf1, leaf2);
				}
				max_dist_leaf1 = leaf1;
				max_dist_leaf2 = leaf2;
			}

			int insert_pos;
			max_depth++;

			for (insert_pos = 0; insert_pos < num_deep_leaves; ++insert_pos) {
				if (max_depth > max_depths[insert_pos] || (max_depth == max_depths[insert_pos] && deepest_leaf_id < deepest_leaves[insert_pos]))
					break;
			}
			if (insert_pos < 2) {
				memmove(max_depths + insert_pos + 1, max_depths + insert_pos, sizeof(int) * (1 - insert_pos));
				memmove(deepest_leaves + insert_pos + 1, deepest_leaves + insert_pos, sizeof(int) * (1 - insert_pos));
				max_depths[insert_pos] = max_depth;
				deepest_leaves[insert_pos] = deepest_leaf_id;
				if (num_deep_leaves < 2)
					num_deep_leaves++;
			}
		}

		int depth_sum = 0;
		for (int i = 0; i < num_deep_leaves; ++i) {
			depth_sum += max_depths[i];
		}

		if (num_deep_leaves == 2 && (depth_sum > max_dist ||
					(depth_sum == max_dist && deepest_leaves[0] < max_dist_leaf1))) {
			*max_depth_r = max_depths[0];
			*deepest_leaf_id_r = deepest_leaves[0];
			*distance_between_deepest_r = depth_sum;
			*leaf1_r = deepest_leaves[0];
			*leaf2_r = deepest_leaves[1];
		}
		else {
			if (!parent && isLeaf() && (max_depths[0] > max_dist ||
						(max_depths[0] == max_dist &&
						 (this->id < max_dist_leaf1 || deepest_leaves[0] < max_dist_leaf1)))) {
				*max_depth_r = max_depths[0];
				*deepest_leaf_id_r = deepest_leaves[0];
				*distance_between_deepest_r = max_depths[0];
				*leaf1_r = min(this->id, deepest_leaves[0]);
				*leaf2_r = max(this->id, deepest_leaves[0]);
			}
			else {
				*max_depth_r = max_depths[0];
				*deepest_leaf_id_r = deepest_leaves[0];
				*distance_between_deepest_r = max_dist;
				*leaf1_r = max_dist_leaf1;
				*leaf2_r = max_dist_leaf2;
			}
		}
	}
}

int
Node::traverseLength(Node *parent) {
	int total = 0;
	for (std::list<Node *>::iterator it = edges.begin(); it != edges.end(); ++it) {
		if (parent && (*it)->getId() == parent->getId())
			continue;

		/* We'll need to follow this edge, traverse the subtree
		 * and then follow the edge back up */
		total += 2 + (*it)->traverseLength(this);
	}
	return total;
}

void
Node::pruneEmptyLeaves(Node *parent) {
	std::list<Node *> new_edges;
	for (std::list<Node *>::iterator it = edges.begin(); it != edges.end(); ++it) {
		bool keep = true;
		if (!(parent && (*it)->getId() == parent->getId())) {
			if ((*it)->isLeaf()) {
				if (!(*it)->containsHumans()) {
					keep = false;
					//std::cerr << "pruning node " << (*it)->getId() << std::endl;
				}
			}
			else {
				(*it)->pruneEmptyLeaves(this);
			}
		}
		if (keep)
			new_edges.push_back(*it);
	}
	edges = new_edges;
}

int main(int argc, char **argv) {
	int num_cities, num_cities_attacked;
	std::vector<Node *> tree;

	std::cin >> num_cities >> num_cities_attacked;

	for (int i = 0; i < num_cities; ++i) {
		tree.push_back(new Node(i + 1));
	}

	for (int i = 0; i < num_cities - 1; ++i) {
		int node1, node2;

		std::cin >> node1 >> node2;

		tree[node1 - 1]->addEdge(tree[node2 - 1]);
		tree[node2 - 1]->addEdge(tree[node1 - 1]);
	}

	int root = -1;
	for (int i = 0; i < num_cities_attacked; ++i) {
		int node;
		std::cin >> node;
		tree[node - 1]->placeHumans();
		if (root < 0)
			root = node;
	}

	/* The root is an arbitrary node with humans on it */
	Node *root_node = tree[root - 1];
	root_node->pruneEmptyLeaves(NULL);

	int trav_len = root_node->traverseLength(NULL);

	int max_depth = 0;
	int deepest_leaf_id = -1;
	int distance_between_deepest = -1;
	int leaf1 = -1, leaf2 = -1;

	root_node->distanceBetweenTwoDeepestLeaves(&max_depth, &deepest_leaf_id,
			&distance_between_deepest, &leaf1, &leaf2, NULL);

	int shortest_path = trav_len - distance_between_deepest;
	int start_leaf = leaf1;
	if (leaf1 > leaf2)
		start_leaf = leaf2;

	//std::cerr << leaf1 << " " << leaf2 << " " << trav_len << " " << distance_between_deepest << std::endl;

	std::cout << start_leaf << std::endl << shortest_path << std::endl;

	for (int i = 0; i < tree.size(); ++i)
		delete tree[i];

	return 0;
}


#include <iostream>
#include <list>
#include <vector>
#include <string.h>
#include <limits.h>

class Node {
	private:
		std::list<Node *> edges;
		int id;
		bool humans;

	public:
		Node(int id);
		void placeHumans() { humans = true; }
		bool containsHumans() { return humans; }
		bool isLeaf() { return edges.size() <= 1; }
		int getId() { return id; }
		void addEdge(Node *node);
		void pruneEmptyLeaves(Node *parent);
		void distanceBetweenTwoDeepestLeaves(int *max_depth, int *deepest_leaf_id, int *distance_between_deepest, int *leaf1, int *leaf2, Node *parent);
		int traverseLength(Node *parent);
};

Node::Node(int id) {
	this->id = id;
	humans = false;
}

void
Node::addEdge(Node *node) {
	edges.push_back(node);
}

static int min(int a, int b) {
	return (a < b) ? a : b;
}

static int max(int a, int b) {
	return (a > b) ? a : b;
}

void
Node::distanceBetweenTwoDeepestLeaves(int *max_depth_r, int *deepest_leaf_id_r,
		int *distance_between_deepest_r, int *leaf1_r, int *leaf2_r,
		Node *parent) {
	if ((parent && this->isLeaf()) || edges.size() == 0) {
		*max_depth_r = 0;
		*deepest_leaf_id_r = id;
		*distance_between_deepest_r = 0;
		*leaf1_r = *leaf2_r = id;
	}
	else {
		int max_depths[2];
		int deepest_leaves[2];
		int num_deep_leaves = 0;
		int max_dist = INT_MIN;
		int max_dist_leaf1 = -1, max_dist_leaf2 = -1;

		for (std::list<Node *>::iterator it = edges.begin(); it != edges.end(); ++it) {
			int max_depth, deepest_leaf_id, distance_between_deepest, leaf1, leaf2;
			if (parent && (*it)->getId() == parent->getId())
				continue;

			(*it)->distanceBetweenTwoDeepestLeaves(&max_depth, &deepest_leaf_id, &distance_between_deepest, &leaf1, &leaf2, this);

			if (distance_between_deepest > max_dist ||
					(distance_between_deepest == max_dist && min(leaf1, leaf2) < min(max_dist_leaf1, max_dist_leaf2))) {
				max_dist = distance_between_deepest;
				if (leaf1 > leaf2) {
					std::swap(leaf1, leaf2);
				}
				max_dist_leaf1 = leaf1;
				max_dist_leaf2 = leaf2;
			}

			int insert_pos;
			max_depth++;

			for (insert_pos = 0; insert_pos < num_deep_leaves; ++insert_pos) {
				if (max_depth > max_depths[insert_pos] || (max_depth == max_depths[insert_pos] && deepest_leaf_id < deepest_leaves[insert_pos]))
					break;
			}
			if (insert_pos < 2) {
				memmove(max_depths + insert_pos + 1, max_depths + insert_pos, sizeof(int) * (1 - insert_pos));
				memmove(deepest_leaves + insert_pos + 1, deepest_leaves + insert_pos, sizeof(int) * (1 - insert_pos));
				max_depths[insert_pos] = max_depth;
				deepest_leaves[insert_pos] = deepest_leaf_id;
				if (num_deep_leaves < 2)
					num_deep_leaves++;
			}
		}

		int depth_sum = 0;
		for (int i = 0; i < num_deep_leaves; ++i) {
			depth_sum += max_depths[i];
		}

		if (num_deep_leaves == 2 && (depth_sum > max_dist ||
					(depth_sum == max_dist && min(deepest_leaves[0], deepest_leaves[1]) < min(max_dist_leaf1, max_dist_leaf2)))) {
			*max_depth_r = max_depths[0];
			*deepest_leaf_id_r = deepest_leaves[0];
			*distance_between_deepest_r = depth_sum;
			*leaf1_r = deepest_leaves[0];
			*leaf2_r = deepest_leaves[1];
		}
		else {
			if (!parent && isLeaf() && (max_depths[0] > max_dist ||
						(max_depths[0] == max_dist &&
						 (this->id < min(max_dist_leaf1, max_dist_leaf2) || deepest_leaves[0] < min(max_dist_leaf1, max_dist_leaf2))))) {
				*max_depth_r = max_depths[0];
				*deepest_leaf_id_r = deepest_leaves[0];
				*distance_between_deepest_r = max_depths[0];
				*leaf1_r = min(this->id, deepest_leaves[0]);
				*leaf2_r = max(this->id, deepest_leaves[0]);
			}
			else {
				*max_depth_r = max_depths[0];
				*deepest_leaf_id_r = deepest_leaves[0];
				*distance_between_deepest_r = max_dist;
				*leaf1_r = max_dist_leaf1;
				*leaf2_r = max_dist_leaf2;
			}
		}
	}
}

int
Node::traverseLength(Node *parent) {
	int total = 0;
	for (std::list<Node *>::iterator it = edges.begin(); it != edges.end(); ++it) {
		if (parent && (*it)->getId() == parent->getId())
			continue;

		/* We'll need to follow this edge, traverse the subtree
		 * and then follow the edge back up */
		total += 2 + (*it)->traverseLength(this);
	}
	return total;
}

void
Node::pruneEmptyLeaves(Node *parent) {
	std::list<Node *> new_edges;
	for (std::list<Node *>::iterator it = edges.begin(); it != edges.end(); ++it) {
		bool keep = true;
		if (!(parent && (*it)->getId() == parent->getId())) {
			(*it)->pruneEmptyLeaves(this);
			if ((*it)->isLeaf()) {
				if (!(*it)->containsHumans()) {
					keep = false;
					//std::cerr << "pruning node " << (*it)->getId() << std::endl;
				}
			}
		}
		if (keep)
			new_edges.push_back(*it);
	}
	edges = new_edges;
}

int main(int argc, char **argv) {
	int num_cities, num_cities_attacked;
	std::vector<Node *> tree;

	std::cin >> num_cities >> num_cities_attacked;

	for (int i = 0; i < num_cities; ++i) {
		tree.push_back(new Node(i + 1));
	}

	for (int i = 0; i < num_cities - 1; ++i) {
		int node1, node2;

		std::cin >> node1 >> node2;

		tree[node1 - 1]->addEdge(tree[node2 - 1]);
		tree[node2 - 1]->addEdge(tree[node1 - 1]);
	}

	int root = -1;
	for (int i = 0; i < num_cities_attacked; ++i) {
		int node;
		std::cin >> node;
		tree[node - 1]->placeHumans();
		if (root < 0)
			root = node;
	}

	/* The root is an arbitrary node with humans on it */
	Node *root_node = tree[root - 1];
	root_node->pruneEmptyLeaves(NULL);

	int trav_len = root_node->traverseLength(NULL);

	int max_depth = 0;
	int deepest_leaf_id = -1;
	int distance_between_deepest = -1;
	int leaf1 = -1, leaf2 = -1;

	root_node->distanceBetweenTwoDeepestLeaves(&max_depth, &deepest_leaf_id,
			&distance_between_deepest, &leaf1, &leaf2, NULL);

	int shortest_path = trav_len - distance_between_deepest;
	int start_leaf = leaf1;
	if (leaf1 > leaf2)
		start_leaf = leaf2;

	//std::cerr << leaf1 << " " << leaf2 << " " << trav_len << " " << distance_between_deepest << std::endl;

	std::cout << start_leaf << std::endl << shortest_path << std::endl;

	for (int i = 0; i < tree.size(); ++i)
		delete tree[i];

	return 0;
}


#include <iostream>
#include <list>
#include <vector>
#include <string.h>
#include <limits.h>

class Node {
	private:
		std::list<Node *> edges;
		int id;
		bool humans;

	public:
		Node(int id);
		void placeHumans() { humans = true; }
		bool containsHumans() { return humans; }
		bool isLeaf() { return edges.size() <= 1; }
		int getId() { return id; }
		void addEdge(Node *node);
		void pruneEmptyLeaves(Node *parent);
		void distanceBetweenTwoDeepestLeaves(int *max_depth, int *deepest_leaf_id, int *distance_between_deepest, int *leaf1, int *leaf2, Node *parent);
		int traverseLength(Node *parent);
};

Node::Node(int id) {
	this->id = id;
	humans = false;
}

void
Node::addEdge(Node *node) {
	edges.push_back(node);
}

static int min(int a, int b) {
	return (a < b) ? a : b;
}

static int max(int a, int b) {
	return (a > b) ? a : b;
}

void
Node::distanceBetweenTwoDeepestLeaves(int *max_depth_r, int *deepest_leaf_id_r,
		int *distance_between_deepest_r, int *leaf1_r, int *leaf2_r,
		Node *parent) {
	if ((parent && this->isLeaf()) || edges.size() == 0) {
		*max_depth_r = 0;
		*deepest_leaf_id_r = id;
		*distance_between_deepest_r = 0;
		*leaf1_r = *leaf2_r = id;
	}
	else {
		int max_depths[2];
		int deepest_leaves[2];
		int num_deep_leaves = 0;
		int max_dist = INT_MIN;
		int max_dist_leaf1 = -1, max_dist_leaf2 = -1;

		for (std::list<Node *>::iterator it = edges.begin(); it != edges.end(); ++it) {
			int max_depth, deepest_leaf_id, distance_between_deepest, leaf1, leaf2;
			if (parent && (*it)->getId() == parent->getId())
				continue;

			(*it)->distanceBetweenTwoDeepestLeaves(&max_depth, &deepest_leaf_id, &distance_between_deepest, &leaf1, &leaf2, this);

			if (distance_between_deepest > max_dist ||
					(distance_between_deepest == max_dist && min(leaf1, leaf2) < min(max_dist_leaf1, max_dist_leaf2))) {
				max_dist = distance_between_deepest;
				if (leaf1 > leaf2) {
					std::swap(leaf1, leaf2);
				}
				max_dist_leaf1 = leaf1;
				max_dist_leaf2 = leaf2;
			}

			int insert_pos;
			max_depth++;

			for (insert_pos = 0; insert_pos < num_deep_leaves; ++insert_pos) {
				if (max_depth > max_depths[insert_pos] || (max_depth == max_depths[insert_pos] && deepest_leaf_id < deepest_leaves[insert_pos]))
					break;
			}
			if (insert_pos < 2) {
				memmove(max_depths + insert_pos + 1, max_depths + insert_pos, sizeof(int) * (1 - insert_pos));
				memmove(deepest_leaves + insert_pos + 1, deepest_leaves + insert_pos, sizeof(int) * (1 - insert_pos));
				max_depths[insert_pos] = max_depth;
				deepest_leaves[insert_pos] = deepest_leaf_id;
				if (num_deep_leaves < 2)
					num_deep_leaves++;
			}
		}

		int depth_sum = 0;
		for (int i = 0; i < num_deep_leaves; ++i) {
			depth_sum += max_depths[i];
		}

		if (num_deep_leaves == 2 && (depth_sum > max_dist ||
					(depth_sum == max_dist && min(deepest_leaves[0], deepest_leaves[1]) < min(max_dist_leaf1, max_dist_leaf2)))) {
			*max_depth_r = max_depths[0];
			*deepest_leaf_id_r = deepest_leaves[0];
			*distance_between_deepest_r = depth_sum;
			*leaf1_r = deepest_leaves[0];
			*leaf2_r = deepest_leaves[1];
		}
		else {
			if (!parent && isLeaf() && (max_depths[0] > max_dist ||
						(max_depths[0] == max_dist &&
						 (this->id < min(max_dist_leaf1, max_dist_leaf2) || deepest_leaves[0] < min(max_dist_leaf1, max_dist_leaf2))))) {
				*max_depth_r = max_depths[0];
				*deepest_leaf_id_r = deepest_leaves[0];
				*distance_between_deepest_r = max_depths[0];
				*leaf1_r = min(this->id, deepest_leaves[0]);
				*leaf2_r = max(this->id, deepest_leaves[0]);
			}
			else {
				*max_depth_r = max_depths[0];
				*deepest_leaf_id_r = deepest_leaves[0];
				*distance_between_deepest_r = max_dist;
				*leaf1_r = max_dist_leaf1;
				*leaf2_r = max_dist_leaf2;
			}
		}
	}
}

int
Node::traverseLength(Node *parent) {
	int total = 0;
	for (std::list<Node *>::iterator it = edges.begin(); it != edges.end(); ++it) {
		if (parent && (*it)->getId() == parent->getId())
			continue;

		/* We'll need to follow this edge, traverse the subtree
		 * and then follow the edge back up */
		total += 2 + (*it)->traverseLength(this);
	}
	return total;
}

void
Node::pruneEmptyLeaves(Node *parent) {
	std::list<Node *> new_edges;
	for (std::list<Node *>::iterator it = edges.begin(); it != edges.end(); ++it) {
		bool keep = true;
		if (!(parent && (*it)->getId() == parent->getId())) {
			if ((*it)->isLeaf()) {
				if (!(*it)->containsHumans()) {
					keep = false;
					//std::cerr << "pruning node " << (*it)->getId() << std::endl;
				}
			}
			else {
				(*it)->pruneEmptyLeaves(this);
			}
		}
		if (keep)
			new_edges.push_back(*it);
	}
	edges = new_edges;
}

int main(int argc, char **argv) {
	int num_cities, num_cities_attacked;
	std::vector<Node *> tree;

	std::cin >> num_cities >> num_cities_attacked;

	for (int i = 0; i < num_cities; ++i) {
		tree.push_back(new Node(i + 1));
	}

	for (int i = 0; i < num_cities - 1; ++i) {
		int node1, node2;

		std::cin >> node1 >> node2;

		tree[node1 - 1]->addEdge(tree[node2 - 1]);
		tree[node2 - 1]->addEdge(tree[node1 - 1]);
	}

	int root = -1;
	for (int i = 0; i < num_cities_attacked; ++i) {
		int node;
		std::cin >> node;
		tree[node - 1]->placeHumans();
		if (root < 0)
			root = node;
	}

	/* The root is an arbitrary node with humans on it */
	Node *root_node = tree[root - 1];
	root_node->pruneEmptyLeaves(NULL);

	int trav_len = root_node->traverseLength(NULL);

	int max_depth = 0;
	int deepest_leaf_id = -1;
	int distance_between_deepest = -1;
	int leaf1 = -1, leaf2 = -1;

	root_node->distanceBetweenTwoDeepestLeaves(&max_depth, &deepest_leaf_id,
			&distance_between_deepest, &leaf1, &leaf2, NULL);

	int shortest_path = trav_len - distance_between_deepest;
	int start_leaf = leaf1;
	if (leaf1 > leaf2)
		start_leaf = leaf2;

	//std::cerr << leaf1 << " " << leaf2 << " " << trav_len << " " << distance_between_deepest << std::endl;

	std::cout << start_leaf << std::endl << shortest_path << std::endl;

	for (int i = 0; i < tree.size(); ++i)
		delete tree[i];

	return 0;
}


#include <iostream>
#include <list>
#include <vector>
#include <string.h>
#include <limits.h>

class Node {
	private:
		std::list<Node *> edges;
		int id;
		bool humans;

	public:
		Node(int id);
		void placeHumans() { humans = true; }
		bool containsHumans() { return humans; }
		bool isLeaf() { return edges.size() <= 1; }
		int getId() { return id; }
		void addEdge(Node *node);
		void pruneEmptyLeaves(Node *parent);
		void distanceBetweenTwoDeepestLeaves(int *max_depth, int *deepest_leaf_id, int *distance_between_deepest, int *leaf1, int *leaf2, Node *parent);
		int traverseLength(Node *parent);
};

Node::Node(int id) {
	this->id = id;
	humans = false;
}

void
Node::addEdge(Node *node) {
	edges.push_back(node);
}

static int min(int a, int b) {
	return (a < b) ? a : b;
}

static int max(int a, int b) {
	return (a > b) ? a : b;
}

void
Node::distanceBetweenTwoDeepestLeaves(int *max_depth_r, int *deepest_leaf_id_r,
		int *distance_between_deepest_r, int *leaf1_r, int *leaf2_r,
		Node *parent) {
	if (parent && this->isLeaf()) {
		*max_depth_r = 0;
		*deepest_leaf_id_r = id;
		*distance_between_deepest_r = 0;
		*leaf1_r = *leaf2_r = id;
	}
	else {
		int max_depths[2];
		int deepest_leaves[2];
		int num_deep_leaves = 0;
		int max_dist = INT_MIN;
		int max_dist_leaf1 = -1, max_dist_leaf2 = -1;

		for (std::list<Node *>::iterator it = edges.begin(); it != edges.end(); ++it) {
			int max_depth, deepest_leaf_id, distance_between_deepest, leaf1, leaf2;
			if (parent && (*it)->getId() == parent->getId())
				continue;

			(*it)->distanceBetweenTwoDeepestLeaves(&max_depth, &deepest_leaf_id, &distance_between_deepest, &leaf1, &leaf2, this);

			if (distance_between_deepest > max_dist ||
					(distance_between_deepest == max_dist && min(leaf1, leaf2) < min(max_dist_leaf1, max_dist_leaf2))) {
				max_dist = distance_between_deepest;
				if (leaf1 > leaf2) {
					std::swap(leaf1, leaf2);
				}
				max_dist_leaf1 = leaf1;
				max_dist_leaf2 = leaf2;
			}

			int insert_pos;
			max_depth++;

			for (insert_pos = 0; insert_pos < num_deep_leaves; ++insert_pos) {
				if (max_depth > max_depths[insert_pos] || (max_depth == max_depths[insert_pos] && deepest_leaf_id < deepest_leaves[insert_pos]))
					break;
			}
			if (insert_pos < 2) {
				memmove(max_depths + insert_pos + 1, max_depths + insert_pos, sizeof(int) * (1 - insert_pos));
				memmove(deepest_leaves + insert_pos + 1, deepest_leaves + insert_pos, sizeof(int) * (1 - insert_pos));
				max_depths[insert_pos] = max_depth;
				deepest_leaves[insert_pos] = deepest_leaf_id;
				if (num_deep_leaves < 2)
					num_deep_leaves++;
			}
		}

		int depth_sum = 0;
		for (int i = 0; i < num_deep_leaves; ++i) {
			depth_sum += max_depths[i];
		}

		if (num_deep_leaves == 2 && (depth_sum > max_dist ||
					(depth_sum == max_dist && deepest_leaves[0] < max_dist_leaf1))) {
			*max_depth_r = max_depths[0];
			*deepest_leaf_id_r = deepest_leaves[0];
			*distance_between_deepest_r = depth_sum;
			*leaf1_r = deepest_leaves[0];
			*leaf2_r = deepest_leaves[1];
		}
		else {
			if (!parent && isLeaf() && (max_depths[0] > max_dist ||
						(max_depths[0] == max_dist &&
						 (this->id < max_dist_leaf1 || deepest_leaves[0] < max_dist_leaf1)))) {
				*max_depth_r = max_depths[0];
				*deepest_leaf_id_r = deepest_leaves[0];
				*distance_between_deepest_r = max_depths[0];
				*leaf1_r = min(this->id, deepest_leaves[0]);
				*leaf2_r = max(this->id, deepest_leaves[0]);
			}
			else {
				*max_depth_r = max_depths[0];
				*deepest_leaf_id_r = deepest_leaves[0];
				*distance_between_deepest_r = max_dist;
				*leaf1_r = max_dist_leaf1;
				*leaf2_r = max_dist_leaf2;
			}
		}
	}
}

int
Node::traverseLength(Node *parent) {
	int total = 0;
	for (std::list<Node *>::iterator it = edges.begin(); it != edges.end(); ++it) {
		if (parent && (*it)->getId() == parent->getId())
			continue;

		/* We'll need to follow this edge, traverse the subtree
		 * and then follow the edge back up */
		total += 2 + (*it)->traverseLength(this);
	}
	return total;
}

void
Node::pruneEmptyLeaves(Node *parent) {
	std::list<Node *> new_edges;
	for (std::list<Node *>::iterator it = edges.begin(); it != edges.end(); ++it) {
		bool keep = true;
		if (!(parent && (*it)->getId() == parent->getId())) {
			if ((*it)->isLeaf()) {
				if (!(*it)->containsHumans()) {
					keep = false;
					//std::cerr << "pruning node " << (*it)->getId() << std::endl;
				}
			}
			else {
				(*it)->pruneEmptyLeaves(this);
			}
		}
		if (keep)
			new_edges.push_back(*it);
	}
	edges = new_edges;
}

int main(int argc, char **argv) {
	int num_cities, num_cities_attacked;
	std::vector<Node *> tree;

	std::cin >> num_cities >> num_cities_attacked;

	for (int i = 0; i < num_cities; ++i) {
		tree.push_back(new Node(i + 1));
	}

	for (int i = 0; i < num_cities - 1; ++i) {
		int node1, node2;

		std::cin >> node1 >> node2;

		tree[node1 - 1]->addEdge(tree[node2 - 1]);
		tree[node2 - 1]->addEdge(tree[node1 - 1]);
	}

	int root = -1;
	for (int i = 0; i < num_cities_attacked; ++i) {
		int node;
		std::cin >> node;
		tree[node - 1]->placeHumans();
		if (root < 0)
			root = node;
	}

	/* The root is an arbitrary node with humans on it */
	Node *root_node = tree[root - 1];
	root_node->pruneEmptyLeaves(NULL);

	int trav_len = root_node->traverseLength(NULL);

	int max_depth = 0;
	int deepest_leaf_id = -1;
	int distance_between_deepest = -1;
	int leaf1 = -1, leaf2 = -1;

	root_node->distanceBetweenTwoDeepestLeaves(&max_depth, &deepest_leaf_id,
			&distance_between_deepest, &leaf1, &leaf2, NULL);

	int shortest_path = trav_len - distance_between_deepest;
	int start_leaf = leaf1;
	if (leaf1 > leaf2)
		start_leaf = leaf2;

	//std::cerr << leaf1 << " " << leaf2 << " " << trav_len << " " << distance_between_deepest << std::endl;

	std::cout << start_leaf << std::endl << shortest_path << std::endl;

	for (int i = 0; i < tree.size(); ++i)
		delete tree[i];

	return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#define MAXN 200000
using namespace std;
typedef pair <int,int> ii;
vector <int> g[MAXN];
vector <int> dp[MAXN];
vector <ii> lontano[MAXN];
int bad[MAXN];
int calcola(int u, int i)
{
	if(dp[u][i]!=MAXN)
		return dp[u][i];
	int x=g[u][i];
	int f, j;
	dp[u][i]=1;
	for(j=0; j<(int)g[x].size(); j++)
	{
		f=g[x][j];
		if(f!=u)
			dp[u][i]+=calcola(x,j);
	}
	if(dp[u][i]==1 && bad[x]==0)
		dp[u][i]=0;
	return dp[u][i];
}
ii trova(int u, int i)
{
	if(lontano[u][i]!=ii(-1,-1))
			return lontano[u][i];
		int x=g[u][i];
		int f, j;
		for(j=0; j<(int)g[x].size(); j++)
		{
			f=g[x][j];
			ii temp;
			if(f!=u)
				{
					temp=trova(x,j);
					if(temp.second > lontano[u][i].second)
						lontano[u][i]=temp;
				}
		}
		if(lontano[u][i].first==-1 && bad[x] == 1)
			lontano[u][i]=ii(x,1);
		else if(lontano[u][i]==ii(-1,-1))
			lontano[u][i]=ii(-1,0);
		else if(lontano[u][i]!=ii(-1,-1))
			lontano[u][i].second+=1;
		return lontano[u][i];

}
int sol = 0;
int res = -1;
int coda = -1;
int dfs(int x, int p)
{
	if(x==coda)
		return 1;
	int f=0, i=0;
	for(i=0; i<(int)g[x].size(); i++)
	{
		f=g[x][i];
		if(f!=p)
		{
			if(dfs(f,x)==1)
			{
				int j=0;
				int temp=-1;
				for(j=0; j<(int)g[x].size(); j++)
				{
					temp = g[x][j];
					if(temp!=p && temp!= f)
						sol+=2*calcola(x,j);
				}
				return 1;
			}
		}
	}
	return 0;
}
int main()
{
	//freopen("input.txt", "r", stdin);
	int M, N;
	scanf("%d %d", &N, &M);
	int i=0, j=0;
	for(i=0; i<N-1; i++)
	{
		int a, b;
		scanf("%d %d", &a, &b);
		g[a].push_back(b);
		g[b].push_back(a);
		dp[a].push_back(MAXN);
		dp[b].push_back(MAXN);
		lontano[a].push_back(ii(-1,-1));
		lontano[b].push_back(ii(-1,-1));
	}
	for(i=0; i<M; i++)
	{
		int a;
		scanf("%d", &a);
		bad[a]=1;
	}
	int massimo = -1;
	for(i=1; i<=N; i++)
	{
		for(j=0; j<(int)g[i].size(); j++)
			{
				ii temp = trova(i, j);
				if(bad[i]== 1 && temp.second > massimo)
				{
					massimo = temp.second;
					res = i;
					coda = temp.first;
				}
			}
	}
	dfs(res, res);
	sol+=massimo;
	printf("%d\n%d", res, sol);

	return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#define MAXN 200000
using namespace std;
typedef pair <int,int> ii;
vector <int> g[MAXN];
vector <int> dp[MAXN];
vector <ii> lontano[MAXN];
vector <int> pos[MAXN];
ii best[MAXN][2];
int mancante[MAXN];
int bad[MAXN];
int calcola(int u, int i)
{
	if(dp[u][i]!=MAXN)
		return dp[u][i];
	int x=g[u][i];
	int f, j;
	dp[u][i]=1;
	for(j=0; j<(int)g[x].size(); j++)
	{
		f=g[x][j];
		if(f!=u)
			dp[u][i]+=calcola(x,j);
	}
	if(dp[u][i]==1 && bad[x]==0)
		dp[u][i]=0;
	return dp[u][i];
}
ii trova(int u, int i)
{
	if(lontano[u][i]!=ii(-1,-1))
		return lontano[u][i];
	int x=g[u][i];
	int f, j;
	if(best[x][0]==ii(-1,-1))
	{
		for(j=0; j<(int)g[x].size(); j++)
		{
			f=g[x][j];
			ii temp;
			if(f==u)
			{
				mancante[x]=j;
				continue;
			}
			temp=trova(x,j);
			if(temp.second > lontano[u][i].second)
				lontano[u][i]=temp;
			if(temp.second >= best[x][0].second)
			{
				best[x][1]=best[x][0];
				best[x][0]=temp;
			}
			else if(temp.second > best[x][1].second)
				best[x][1]=temp;
		}
		if(best[x][0].first==-1)
		{
			if(bad[x]==1)
				best[x][0].first=x;
			best[x][0].second=0;
		}
		if(lontano[u][i].first!=-1)
			lontano[u][i].second+=1;
		else if(lontano[u][i].first==-1 && bad[x] == 1)
			lontano[u][i]=ii(x,1);
		else if(lontano[u][i]==ii(-1,-1))
			lontano[u][i]=ii(-1,0);
		return lontano[u][i];
	}
	if(g[x][mancante[x]]==u)
			return best[x][0];
	int inverso = pos[u][i];
	ii temp;
	if(best[x][0]==lontano[x][inverso])
		temp = best[x][1];
	else
		temp = best[x][0];
	lontano[x][mancante[x]]=trova(x,mancante[x]);
	if(lontano[x][mancante[x]].first!=-1 && lontano[x][mancante[x]].second+1>temp.second)
			temp=lontano[x][mancante[x]];
	if(temp.first!=-1)
		temp.second+=1;
	else if(temp.first==-1 && bad[x] == 1)
		temp=ii(x,1);
	return temp;
}
int sol = 0;
int res = -1;
int coda = -1;
int dfs(int x, int p)
{
	if(x==coda)
		return 1;
	int f=0, i=0;
	for(i=0; i<(int)g[x].size(); i++)
	{
		f=g[x][i];
		if(f!=p)
		{
			if(dfs(f,x)==1)
			{
				int j=0;
				int temp=-1;
				for(j=0; j<(int)g[x].size(); j++)
				{
					temp = g[x][j];
					if(temp!=p && temp!= f)
						sol+=2*calcola(x,j);
				}
				return 1;
			}
		}
	}
	return 0;
}
int main()
{
	int M, N;
	scanf("%d %d", &N, &M);
	int i=0, j=0;
	for(i=0; i<N-1; i++)
	{
		int a, b;
		scanf("%d %d", &a, &b);
		g[a].push_back(b);
		g[b].push_back(a);
		dp[a].push_back(MAXN);
		dp[b].push_back(MAXN);
		lontano[a].push_back(ii(-1,-1));
		lontano[b].push_back(ii(-1,-1));
		pos[a].push_back(pos[b].size());
		pos[b].push_back(pos[a].size()-1);
	}
	for(i=1; i<=N; i++)
		best[i][0]=best[i][1]=ii(-1,-1);
	for(i=0; i<M; i++)
	{
		int a;
		scanf("%d", &a);
		bad[a]=1;
	}
	if(N==1)
	{
		printf("1\n0");
		return 0;
	}
	int massimo = -1;
	for(i=1; i<=N; i++)
	{
		for(j=0; j<(int)g[i].size(); j++)
			{
				ii temp = trova(i, j);
				if(bad[i]== 1 && temp.second > massimo)
				{
					massimo = temp.second;
					res = i;
					coda = temp.first;
					//printf("massimo: %d %d %d\n", res, coda, massimo);
				}
			}
	}
	//for(i=1; i<=N; i++)
	//	printf("%d %d\n", best[i][0].first, best[i][0].second);
	dfs(res, res);
	sol+=massimo;
	printf("%d\n%d", res, sol);
	return 0;
}