Caisa is going to have a party and he needs to buy the ingredients for a big chocolate cake. For that he is going to the biggest supermarket in town.

Unfortunately, he has just s dollars for sugar. But that's not a reason to be sad, because there are n types of sugar in the supermarket, maybe he able to buy one. But that's not all. The supermarket has very unusual exchange politics: instead of cents the sellers give sweets to a buyer as a change. Of course, the number of given sweets always doesn't exceed 99, because each seller maximizes the number of dollars in the change (100 cents can be replaced with a dollar).

Caisa wants to buy only one type of sugar, also he wants to maximize the number of sweets in the change. What is the maximum number of sweets he can get? Note, that Caisa doesn't want to minimize the cost of the sugar, he only wants to get maximum number of sweets as change. 


-----Input-----

The first line contains two space-separated integers n, s (1 ≤ n, s ≤ 100).

The i-th of the next n lines contains two integers x_{i}, y_{i} (1 ≤ x_{i} ≤ 100; 0 ≤ y_{i} < 100), where x_{i} represents the number of dollars and y_{i} the number of cents needed in order to buy the i-th type of sugar.


-----Output-----

Print a single integer representing the maximum number of sweets he can buy, or -1 if he can't buy any type of sugar.


-----Examples-----
Input
5 10
3 90
12 0
9 70
5 50
7 0

Output
50

Input
5 5
10 10
20 20
30 30
40 40
50 50

Output
-1



-----Note-----

In the first test sample Caisa can buy the fourth type of sugar, in such a case he will take 50 sweets as a change.

Difficulty: interview

Starter code:

Solutions:
import itertools
import math
import random

import time
def timer(f):
    def tmp(*args, **kwargs):
        t = time.time()
        res = f(*args, **kwargs)
        print("Время выполнения функции: %f" % (time.time()-t))
        return res

    return tmp

def genArray(length, lower, upper):
    return [random.randint(lower, upper) for i in range(length)]


n, s = list(map(int, input().split(' ')))
array = [list(map(int, input().split(' '))) for i in range(n)]

res = -100;
for i in range(n):
    if array[i][0]+array[i][1]/100 <= s:
        sdacha = 100 - array[i][1]
        if array[i][1]== 0:
            sdacha = 0
        if sdacha>res:
            res = sdacha

if res == -100:
    print(-1)
else:
    print(res)



"""
Codeforces Contest 264 Div 2 Problem A

Author  : chaotic_iak
Language: Python 3.3.4
"""

def main():
    n,s = read()
    mx = -1
    for i in range(n):
        x,y = read()
        if y == 0 and x <= s:
            mx = max(0, mx)
        elif x < s:
            mx = max(100-y, mx)
    print(mx)

################################### NON-SOLUTION STUFF BELOW

def read(mode=2):
    # 0: String
    # 1: List of strings
    # 2: List of integers
    inputs = input().strip()
    if mode == 0: return inputs
    if mode == 1: return inputs.split()
    if mode == 2: return list(map(int, inputs.split()))

def write(s="\n"):
    if s is None: s = ""
    if isinstance(s, list): s = " ".join(map(str, s))
    s = str(s)
    print(s, end="")

write(main())

n, s = map(int, input().split())
mx = -1
for i in range(n):
    xi, yi = map(int, input().split())
    if xi <= s:
        if xi < s:
            mx = max(mx, (100 - yi) % 100)
        else:
            if yi == 0:
                mx = max(0, mx)
print(mx)

n, s = list(map(int, input().split()))
m = -1
for i in range(n):
	x, y = list(map(int, input().split()))
	csum = (s-x)*100 - y
	if  csum <=s*100 and csum >=0 and csum%100 > m:
		m = csum%100
print(m)


n, s = [int(st) for st in input().split()]
res = -1
for i in range(n):
    x, y = [int(st) for st in input().split()]
    if ( (x + y / 100) <= s):
        if (y == 0):
            y = 100
        res = max(res, 100 - y)
print(res)


m=list(input().split())
n=int(m[0])
s=int(m[1])*100
m=list()
for i in range(n):
    m.append(list(int(x) for x in input().split()))
t=100000
mi=None
t0=0
for i in range(n):
    if ((m[i][0]*100+m[i][1])<=s and (m[i][1]<t)):
        if m[i][1]:
            t=m[i][1]
        else:
            t0=1
if t==100000:
    if t0:
        print('0')
    else:
        print('-1')
else:
    print(100-t)
        



n, s = list(map(int, str.split(input())))
r = -1
for _ in range(n):

    x, y = list(map(int, str.split(input())))
    if x < s or x == s and y == 0:

        r = max(r, 100 - (y or 100))

print(r)


n, s = map(int, input().split())
s *= 100
ans = -1
for i in range(n):
    x, y = map(int, input().split())
    cost = x * 100 + y
    if s<cost:
        continue
    sd = (s - cost) % 100
    ans = max(ans, sd)
print(ans)



num, sdollars = input().split(' ')
n = int(num)
s = int(sdollars)
sweets = -1

for i in range(0, n):

    dollars, cents = input().split(' ')
    d = int(dollars)
    c = int(cents)

    if s < d:
        continue

    if s == d and c > 0:
        continue

    if c == 0:
        if (sweets == -1):
            sweets = 0
        continue

    if (100 - c) > sweets:
        sweets = 100 - c

print(sweets)



n, s = [int(i) for i in input(). split()]
x = [0] * n
y = [0] * n
smin = 100
for i in range(n):
    x[i], y[i] = [int(x) for x in input(). split()]
    if (x[i] < s) and (y[i] < smin) and (y[i] != 0):
        smin = y[i]
if smin == 100:
    smin = -1
    for i in range(n):
        if (x[i] <= s) and (y[i] == 0):
            smin = 0
    print(smin) 
else:
    print(100 - smin)

n,s = list(map(int,input().split()))
x = []
y = []
maximum = 0
k = 0
for i in range(n):
    a, b = list(map(int,input().split()))
    x.append(a)
    y.append(b)
for i in range(n):
    if s>x[i] and 100-y[i]>maximum and y[i]>0:
        maximum = 100-y[i]
    if s < x[i]:
        k+=1
    if s == x[i] and y[i]>0:
        k+=1
if k == n:
    print(-1)
else:
    print(maximum)





n,s=list(map(int,input().split()))
ans=-1
for i in range(n):
    x,y=list(map(int,input().split()))
    if(x==s and y==0):
        ans=max(ans,0)
    if(x<s):
        ans=max(ans,(100-y)%100)
print(ans)


[n,s]=[int(x) for x in input().split()]
t=[-1]
for i in range(1,n+1):
	[a,b]=[int(x) for x in input().split()]
	if a+b*0.01<=s:
		if b==0:
			t.append(0)
		else:
			t.append(100-b)
t.sort(reverse=True)
print(t[0])


n, s = list(map(int, input().split()))
ans = -1
for i in range(n):
    x, y = list(map(int, input().split()))
    if 100 * x + y > 100 * s:
        continue
    ans = max(ans, 0 if y == 0 else 100 - y)
print(ans)


def __starting_point():
    n, s = [int(i) for i in input().split()]
    m = -1

    for i in range(n):
        xi, yi = [int(j) for j in input().split()]
        if xi < s:
            m = max(m, (100 - yi) % 100)
        if xi == s and yi == 0:
            m = max(m, 0)

    print(m)


__starting_point()

n, s = list(map(int, input().split()))
mx = -1
for i in range(n):
    x, y = list(map(int, input().split()))
    if x < s or (x == s and y == 0):
        mx = max(mx, 100 - (y or 100))
print(mx) 


x = input()
lol = False
n = ''
s = ''
for letter in x:
    if letter == ' ':
        lol = True
    else:
        if lol == False:
            n += letter
        if lol == True:
            s += letter
lol = False
n = int(n)
s = 100*int(s)
change = ''
sugars = []
price = ''
changes = []
for i in range(n):
    sugar = input()
    for letter in sugar:
        if letter == ' ':
            lol = True
        else:
            if lol == False:
                price += letter
            if lol == True:
                change += letter
    sugars.append(100*int(price)+ int(change))
    lol = False
    change = ''
    price = ''
for item in sugars:
    if s >= item:
        left = (item-1)%100
        right = 99-left
        changes.append(right)
if len(changes) == 0:
    ans = -1
else:
    ans = max(changes)
print(ans)

n,s=list(map(int,input().split(" ")))
a=[]
aa=[]
aaa=[]
for x in range(n):
	q,qq=list(map(int,input().split(" ")))
	if qq > 0 and s > q:
		a.append(qq)
	aaa.append(qq)
	aa.append(float(q+float(qq/100)))
	pass

if s < min(aa):
	print(-1)
else:
	if len(a) == 0:
		print(0)
		pass
	else:
		print(100-min(a))
	pass




a, b = map(int, input().split(' '))
maxx = 0
mark = False
for i in range(a):
    c, d = map(int, input().split(' '))
    if 100*c+d <= 100*b:
        mark = True
        if d > 0:
            maxx = max(100-d, maxx)
if mark == True:
    print(maxx)
        
else:
    print(-1)

ID = input().split()
n = int(ID[0])
s = int(ID[1]) * 100
ans = -1
for i in range(n):
    ID = input().split()
    x = 100 * int(ID[0]) + int(ID[1])
    if (x <= s) and (s - x) % 100 > ans:
        ans = (s - x) % 100

print(ans)

'''n, s=map(int, input().split())
d=[]
c=-1
while(n>0):
    n-=1
    [xi, yi]=map(int, input().split())
    d.append([xi, 100-yi])
for i in d:
    if(i[0]+((100-i[1])/100)<=s):
        if(i[1]>c and i[1]!=100):
            c=i[1]
print(c)'''
n, s=list(map(int, input().split()))
c=-1
for i in range(n):
    xi, yi=list(map(int, input().split()))
    if(yi==0 and xi<=s):
        c=max(0, c)
    elif(xi<s):
        c=max(100-yi, c)
print(c)


n, s=map(int, input().split())
ans=-1
for i in range(n):
    x, y=map(int, input().split())
    if y==0 and x<=s or y!=0 and x<s:
        ans=max(ans, (100-y)%100)
print(ans)

n, s = input().split()
ans = -1
s = int(s)
for i in range(0,int(n)):
	a, b = input().split()
	a = int(a)
	b = int(b)
	if(s > a or (s == a and b == 0)):
		ans = max(ans, (100 - b) % 100)

print(ans)

Inpt1,Inpt2=list(map(int,input().split()))
Maximum=-1
for i in range(Inpt1):
    Inpt3,Inpt4=list(map(int,input().split()))
    if Inpt4==0 and Inpt3<=Inpt2:
        Maximum=max(0,Maximum)
    elif Inpt3<Inpt2:
        Maximum=max(100-Inpt4,Maximum)
print(Maximum)


(n, s) = [int(i) for i in input().split()]
xy = []
for i in range(n):
	xy.append(tuple(int(i) for i in input().split()))
ans = -1
for pair in xy:
	if (s > pair[0]) or (s == pair[0] and pair[1] == 0):
		ans = max(ans, (100 - pair[1]) % 100)
print(ans)