#include <bits/stdc++.h>
using namespace std;

int main() {
  int name1,name2,name3;
  cin >>name1>>name2;
  name3=name2*2-name1;
  cout<<name3<<endl;
}
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Thousand "Hello World"
    int R, G;
    cin >> R >> G;
    if (R + ((G - R) * 2) / 2 == G){
        cout <<R + ((G - R) * 2) << endl;
    }
    else{
        cout << (R - G) * -1 << endl;
    }
}
