#include<iostream>

using namespace std;


int main()
    {
    int n,m;
    float x;
    cin>>n>>m;
    x=n*m*1.00;
    while (x/(n*1.00)>(m-1)*1.00)
        {
        x=x-1.00;
    }
    cout<<x+1<<endl;
    //system("pause");
    return 0;
}
    
