fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
  6. int n,m,t=1;
  7. //cin>>t;
  8. while(t--)
  9. {
  10. cin>>n>>m;
  11. if(m<=(n+2-1)/2)
  12. cout<<m*2-1;
  13. else
  14. {
  15. m-=(n+2-1)/2;
  16. cout<<m*2;
  17. }
  18. }
  19.  
  20.  
  21. return 0;
  22. }
  23.  
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
65533