#include <bits/stdc++.h>

using namespace std;

void yes(){ cout << "yes" << endl; }
void Yes(){ cout << "Yes" << endl; }
void YES(){ cout << "YES" << endl; }
void no(){ cout << "no" << endl; }
void No(){ cout << "No" << endl; }
void NO(){ cout << "NO" << endl; }
void print(string str){ cout << str << endl;}
#define rep(i, n)for(int i=0; i<n; i++)
#define ll long long

ll inf = 1000000007;
ll INF = 1000000000000000007;


int main(){
  ll x, y;
  cin >> x >> y;
  //

  if(x == y){
    cout << x << endl;  
  return 0;
  }

  
    cout << 3-(x+y) << endl;



  return 0;
}

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

int main() 
{
  int n,x,count = 0;
  cin >> n >> x;
  x *= 100;
  int v[n], p[n];
  for (int i = 0; i < n; i++)
    cin >> v[i] >> p[i];
  for (int i = 0; i < n; i++)
  {
    v[i] *= p[i];
    x -= v[i];
    count++;
    if (x < 0)
    {  
      cout << count << endl;
      return (0);
    }
  }
  cout << -1 << endl;
  return (0);
}