#include <bits/stdc++.h>
#define _CRT_SECURE_NO_WARNINGS
#define endl "\n"
#define ll long long
#define all(x) x.begin(),x.end()
#define Sherlock_Holmes ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define int long long
using namespace std;

signed main()
{
    Sherlock_Holmes

    int n,q; cin>>n>>q;
    vector<ll>v(n);
    set<ll>st;
    for(int i=0; i<n; i++){
        cin>>v[i];
        st.insert(v[i]);
    }

    while (q--){
        int x; cin>>x;

        auto tmp = st.lower_bound(x);
        int idx = distance(st.begin(), tmp);


        if(tmp==st.end()){
            cout<< n << " 0" <<endl;
        }

        //int idx=tmp-st.begin();

        else if(*tmp==x) cout<< idx << " "<<st.size()-idx-1<<endl;
        else cout<<idx << " "<<st.size()-idx<<endl;




    }





}