#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int t;
cin >> t;
int temp = n-1;
int div = t/temp;
int f = 0;
int mod = t%temp;
if(div % 2 == 0 || (div%2 && t%temp==0)){
f = 0;
}
else{
f = 1;
}
if(f == 0){
if(mod != 0){
cout << mod << " " << mod+1<<endl;
}
else{
cout << temp << " " << temp+1 << endl;
}
}
else{
if(mod != 0){
cout << n-mod+1 << " " << n -mod<<endl;
}
else{
cout << 2 << " " << 1 << endl;
}
}
return 0;
}
//I think this code should work for hidden cases as well.