#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, money;
  int max;
  int dollars, cents;
  scanf("%d %d", &n, &money);
  int i;
  max = 0;
  int dollarsInCents1 = money * 100;
  int dollarsInCents2;
  int cur;
  int count = 0;
  for (i = 0; i < n; i++) {
    scanf("%d %d", &dollars, &cents);
    dollarsInCents2 = dollars * 100 + cents;
    cur = dollarsInCents1 - dollarsInCents2;
    if (cur >= 0) {
      cur %= 100;
      if (max < cur) max = cur;
    } else
      count++;
  }
  if (count == n) {
    printf("-1\n");
  } else
    printf("%d\n", max);
  return 0;
}
