#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define num 1e5
void solve() {
int n,q; cin>>n>>q;
deque<int>d(num+1,0);
deque<int>o(n);
for(auto& i:o)
cin>>i;
sort(o.begin(),o.end());
int distinct=0;
for(int i=1;i<n;i++){
if(o[i]!=o[i-1])
distinct++;
d[o[i]]=distinct;
}
while(q--){
int x; cin>>x;
cout<<d[x]<<" "<<distinct-d[x]<<endl;
}
}
int main() {
IOS;
int t=1;
//cin >> t;
while(t--)solve();
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgojZGVmaW5lIGxsIGxvbmcgbG9uZwojZGVmaW5lIElPUyBpb3M6OnN5bmNfd2l0aF9zdGRpbygwKTsgY2luLnRpZSgwKTsgY291dC50aWUoMCk7CiNkZWZpbmUgbnVtIDFlNQoKdm9pZCBzb2x2ZSgpIHsKICAgIGludCBuLHE7IGNpbj4+bj4+cTsKICAgIGRlcXVlPGludD5kKG51bSsxLDApOwogICAgZGVxdWU8aW50Pm8obik7CiAgICBmb3IoYXV0byYgaTpvKQogICAgICAgIGNpbj4+aTsKICAgIHNvcnQoby5iZWdpbigpLG8uZW5kKCkpOwogICAgaW50IGRpc3RpbmN0PTA7CiAgICBmb3IoaW50IGk9MTtpPG47aSsrKXsKICAgICAgICBpZihvW2ldIT1vW2ktMV0pCiAgICAgICAgICAgIGRpc3RpbmN0Kys7CiAgICAgICAgZFtvW2ldXT1kaXN0aW5jdDsKICAgIH0KICAgIHdoaWxlKHEtLSl7CiAgICAgICAgaW50IHg7IGNpbj4+eDsKICAgICAgICBjb3V0PDxkW3hdPDwiICI8PGRpc3RpbmN0LWRbeF08PGVuZGw7CiAgICB9Cn0KCmludCBtYWluKCkgewogICAgSU9TOwogICAgaW50IHQ9MTsKICAgIC8vY2luID4+IHQ7CiAgICB3aGlsZSh0LS0pc29sdmUoKTsKfQo=