Solving Problems#893

Solving Problems

1 second
64 megabytes
Easy

Vasya is preparing for an olympiad, and his teacher has given him problems to work on, where 1 \leq N \leq 100\,000. Each problem requires a certain skill level a_i to solve. If Vasya's current skill level is at least a_i, he can solve this problem. After solving the -th problem, Vasya's skill level increases by b_i.

Vasya starts with an initial skill level of . He can solve the problems in any order. Your task is to determine the maximum number of problems Vasya can solve by choosing the optimal order.

Input

The input starts with two integers and (1 \leq N \leq 100\,000, 0 \leq A \leq 1\,000\,000\,000) — the number of problems and Vasya's initial skill level. Then follow pairs of integers a_i and b_i (1 \leq a_i \leq 10\,000\,000\,000, 1 \leq b_i \leq 1\,000\,000\,000), where a_i is the skill required to solve the -th problem and b_i is the skill Vasya gains after solving it.

Output

Output a single integer — the maximum number of problems Vasya can solve.

Examples

Example 1

Loading
Loading