It is raining heavily. But this is the first day for Serval, who just became 3 years old, to go to the kindergarten. Unfortunately, he lives far from kindergarten, and his father is too busy to drive him there. The only choice for this poor little boy is to wait for a bus on this rainy day. Under such circumstances, the poor boy will use the first bus he sees no matter where it goes. If several buses come at the same time, he will choose one randomly.

Serval will go to the bus station at time $t$, and there are $n$ bus routes which stop at this station. For the $i$-th bus route, the first bus arrives at time $s_i$ minutes, and each bus of this route comes $d_i$ minutes later than the previous one.

As Serval's best friend, you wonder which bus route will he get on. If several buses arrive at the same time, you can print any of them.


-----Input-----

The first line contains two space-separated integers $n$ and $t$ ($1\leq n\leq 100$, $1\leq t\leq 10^5$) — the number of bus routes and the time Serval goes to the station. 

Each of the next $n$ lines contains two space-separated integers $s_i$ and $d_i$ ($1\leq s_i,d_i\leq 10^5$) — the time when the first bus of this route arrives and the interval between two buses of this route.


-----Output-----

Print one number — what bus route Serval will use. If there are several possible answers, you can print any of them.


-----Examples-----
Input
2 2
6 4
9 5

Output
1

Input
5 5
3 3
2 5
5 6
4 9
6 1

Output
3

Input
3 7
2 2
2 3
2 4

Output
1



-----Note-----

In the first example, the first bus of the first route arrives at time $6$, and the first bus of the second route arrives at time $9$, so the first route is the answer.

In the second example, a bus of the third route arrives at time $5$, so it is the answer.

In the third example, buses of the first route come at times $2$, $4$, $6$, $8$, and so fourth, buses of the second route come at times $2$, $5$, $8$, and so fourth and buses of the third route come at times $2$, $6$, $10$, and so on, so $1$ and $2$ are both acceptable answers while $3$ is not.

Difficulty: interview

Starter code:

Solutions:
# AC
import sys


class Main:
    def __init__(self):
        self.buff = None
        self.index = 0

    def __next__(self):
        if self.buff is None or self.index == len(self.buff):
            self.buff = sys.stdin.readline().split()
            self.index = 0
        val = self.buff[self.index]
        self.index += 1
        return val

    def next_int(self):
        return int(next(self))

    def cal(self, s):
        if len(s) == 1:
            return s[0]
        if s[0] == 0:
            return self.cal(s[1:])
        v = 1
        for c in s:
            v *= c
        return v

    def solve(self):
        n = self.next_int()
        t = self.next_int()
        ii = 0
        tt = 10000000
        for i in range(0, n):
            fr = self.next_int()
            d = self.next_int()
            if fr < t:
                fr += (t - fr + d - 1) // d * d
            if fr < tt:
                tt = fr
                ii = i
        print(ii + 1)


def __starting_point():
    Main().solve()

__starting_point()

n, t = list(map(int, input().split()))
nearest_t = 200000
ans = 0
for i in range(n):
    s, d = list(map(int, input().split()))
    if s >= t and s < nearest_t:
        nearest_t = s
        ans = i + 1
    elif s < t:
        k = (t - s) // d
        if (t - s) % d:
            k += 1
        cur_t = s + d * k
        if cur_t < nearest_t:
            nearest_t = cur_t
            ans = i + 1
print(ans)


import sys
from math import ceil

input = sys.stdin.readline

n, t = map(int, input().split())

choose = []

for i in range(1, n+1):
    a, b = map(int, input().split())
    if a < t:
        a += ceil((t-a)/b) * b
    
    choose.append((a-t, i))
choose.sort()

print(choose[0][1])

def main():
    n, t = map(int, input().split())
    mi = 1000000
    ans = 0
    for i in range(n):
        s, d = map(int, input().split())
        L = -1
        R = 1000000
        while R - L != 1:
            M = L + R >> 1
            if s + d * M < t:
                L = M
            else:
                R = M
        if mi > s + d * R:
            mi = s + d * R
            ans = i + 1
    print(ans)
    return 0
main()


n,t=[int(k) for k in input().split(" ")]
mw=100000000000000
nbest=-1

for i in range(n):
    s,d=[int(k) for k in input().split(" ")]
    if t<s:
        w=s-t
    else:
        w=(d-(t-s))%d
    #print(s,d,w,mw,nbest)
    if w<mw:
        mw=w
        nbest=i+1
print(nbest)


from sys import stdin, stdout
n,t=map(int,input().split())
time=1000000
busroute=0
import math
for i in range(n):
         x,y=map(int,input().split())
         if(t<=x):
                  curr=x
         else:
                  curr=math.ceil((t-x)/y)*y +x
         if(curr<time):
                  time=curr
                  busroute=i+1
print(busroute)

N, T = list(map(int, input().split()))

ans = 0
curM = None
for n in range(N):
    s, d = list(map(int, input().split()))
    if T <= s or (T - s) % d == 0:
        s = s
    else:
        incre = ((T - s) // d + 1) * d
        s += incre
    if curM == None:
        curM = s
        
    else:
        if curM > s:
            ans = n
            curM = s
print(ans + 1) 
        


N, T = list(map(int, input().split()))
mi = 10**100
for i in range(N):
    s, d = list(map(int, input().split()))
    if s >= T:
        a = s - T
    else:
        a = (s - T) % d
    if a < mi:
        mi = a
        ans = i + 1
print(ans)


from math import sqrt, ceil, floor
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
import string
import bisect  


n, t = list(map(int, stdin.readline().split()))
ans = 1
ans_t = 9999999
for i in range(n):
    s, d = list(map(int, stdin.readline().split()))
    if s < t:
        s = s + ceil((t - s) / d) * d
    if ans_t > s:
        ans = i + 1
        ans_t = s
print(ans)


n, t = list(map(int, input().split()))
ans = 10**6
ansi = 0
for i in range(n):
    s, d = list(map(int, input().split()))
    s = max(0, t - s + d - 1) // d * d + s
    # print(s)
    if ans > s:
        ans = s
        ansi = i
print(ansi+1)


n, t = map(int, input().split())
res = [float('inf'), 0]
for i in range(1, n + 1):
    s, d = map(int, input().split())
    x = max((t - s + d - 1) // d, 0)
    v = s + d * x
    # print(i, x, v)
    if res[0] > v:
        res = [v, i]
print(res[1])

n,t=[int(i) for i in input().split()]
sd =[[int(i) for i in input().split()] for j in range(n)]

res = -1
best = 10**10

for i in range(n):
    s,d=sd[i]
    if t<=s:
        if s<best:
            best=s
            res=i
    else:
        left = t-s
        times = left//d
        if left%d!=0:
            times+=1
        s+=d*times
        if s<best:
            best=s
            res=i
print(res+1)


N, T = map(int, input().split())
ans = 10**10
Ans = None
for i in range(1, N+1):
    a, b = map(int, input().split())
    if a >= T:
        if a < ans:
            Ans = i
            ans = a
    else:
        k = -((-(T-a))//b)
        if a + k*b < ans:
            Ans = i
            ans = a + k*b
print(Ans)

n, t = map(int, input().strip().split())
mn = 10000000
num = 0
for i in range(n):
    s,d = map(int, input().strip().split())
    temp = 0
    if s >= t:
        temp= s - t
    else:
        g = t - s
        md = g % d
        if md != 0:
            temp = d - md
        else:
            temp = 0
    if temp < mn:
        mn = temp
        num = i+1
print(num)

kk=lambda:map(int,input().split())
# k2=lambda:map(lambda x:int(x)-1, input().split())
ll=lambda:list(kk())
n,t = kk()
mv,j = 10000000000,-1
for i in range(n):
	s,d = kk()
	while s < t: s+=d
	if s < mv: mv,j = s,i
print(j+1)

N, T = list(map(int, input().split()))
bt = -1
br = -1
for n in range(N):
    s, d = list(map(int, input().split()))
    if s >= T:
        a = s
    else:
        a = (T-s+d-1) // d
        a = s+d*a
    if bt == -1 or a < bt:
        bt = a
        br = n+1
print(br)


# -*- coding: utf-8 -*-
# @Time    : 2019/4/13 22:05
# @Author  : LunaFire
# @Email   : gilgemesh2012@gmail.com
# @File    : A. Serval and Bus.py

import math


def main():
    n, t = list(map(int, input().split()))
    ret, best_time = 0, float('inf')
    for i in range(n):
        s, d = list(map(int, input().split()))
        if s < t:
            k = int(math.ceil((t - s) / d))
            s += k * d
        if s < best_time:
            ret = i + 1
            best_time = s
    print(ret)


def __starting_point():
    main()

__starting_point()

n,t=map(int,input().split())
l=[]
for i in range(n):
    s,d=map(int,input().split())
    if s<t:
        if (t-s)%d==0:q=(t-s)//d
        else:q=(t-s)//d+1
        l.append([s+q*d,i+1])
    else:l.append([s,i+1])
l.sort(key=lambda x:x[0])
print(l[0][1])

import math

def main():
    n,t = list(map(int,input().split()))
    buses = []
    min_ans = float('inf')
    index = -1
    for i in range(n):
        s,d = list(map(int,input().split()))
        if s >= t:
            k = 0
        else:
            k = math.ceil((t-s)/d)
        wait = s+(k*d)
        ans = wait-t
        if ans < min_ans:
            min_ans = ans
            index = i+1

    print(index)


main()