import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;

/**
 * @author Egor Kulikov (egor@egork.net)
 *         Created on 14.03.2010
 */
public class TaskA implements Runnable {
	private InputReader in;
	private PrintWriter out;

	public static void main(String[] args) {
		new Thread(new TaskA()).start();
//		new Template().run();
	}

	public TaskA() {
//		String id = getClass().getName().toLowerCase();
//		try {
//			System.setIn(new FileInputStream(id + ".in"));
//			System.setOut(new PrintStream(new FileOutputStream(id + ".out")));
//			System.setIn(new FileInputStream("input.txt"));
//			System.setOut(new PrintStream(new FileOutputStream("output.txt")));
//		} catch (FileNotFoundException e) {
//			throw new RuntimeException();
//		}
		in = new InputReader(System.in);
		out = new PrintWriter(System.out);
	}

	public void run() {
//        int numTests = in.readInt();
//        for (int testNumber = 0; testNumber < numTests; testNumber++) {
//			out.print("Case #" + (testNumber + 1) + ": ");
//        }
		int n = in.readInt();
		int t = in.readInt();
		final int[] x = new int[n];
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			x[i] = in.readInt();
			a[i] = in.readInt();
		}
		Integer[] o = new Integer[n];
		for (int i = 0; i < n; i++)
			o[i] = i;
		Arrays.sort(o, new Comparator<Integer>() {
			public int compare(Integer o1, Integer o2) {
				return x[o1] - x[o2];
			}
		});
		int ans = 2;
		for (int i = 1; i < n; i++) {
			int d = x[o[i]] - x[o[i - 1]];
			d = 2 * d - a[o[i]] - a[o[i - 1]] - 2 * t;
			if (d > 0)
				ans += 2;
			else if (d == 0)
				ans++;
		}
		out.println(ans);
		out.close();
	}

	private static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1000];
		private int curChar, numChars;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		private int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int readInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long readLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public String readString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuffer res = new StringBuffer();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		private boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private String readLine0() {
			StringBuffer buf = new StringBuffer();
			int c = read();
			while (c != '\n' && c != -1) {
				buf.appendCodePoint(c);
				c = read();
			}
			return buf.toString();
		}

		public String readLine() {
			String s = readLine0();
			while (s.trim().length() == 0)
				s = readLine0();
			return s;
		}

		public String readLine(boolean ignoreEmptyLines) {
			if (ignoreEmptyLines)
				return readLine();
			else
				return readLine0();
		}

		public BigInteger readBigInteger() {
			try {
				return new BigInteger(readString());
			} catch (NumberFormatException e) {
				throw new InputMismatchException();
			}
		}

		public char readCharacter() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			return (char) c;
		}

		public double readDouble() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.') {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.') {
				c = read();
				double m = 1;
				while (!isSpaceChar(c)) {
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * Date 22.11.2011
 * Time 17:49:45
 * Author Woodey
 * $
 */

public class A15 {

	final double eps = 10e-9;

	class Pair implements Comparable<Pair>{
		int x;
		int length;

		Pair(int x, int length) {
			this.x = x;
			this.length = length;
		}

		public int compareTo(Pair p) {
			return x - p.x;
		}
	}

	private void Solution() throws IOException {
		int n = nextInt(), t = nextInt(), ans = 2;
		Pair[] pairs = new Pair[n];
		for (int i = 0; i < n; i ++) {
			int x = nextInt(), length = nextInt();
			pairs[i] = new Pair(x, length);
		}
		Arrays.sort(pairs);
		for (int i = 0; i < n-1; i ++) {
			double place = pairs[i+1].x - pairs[i].x - (double) pairs[i+1].length/2 - (double) pairs[i].length/2;
			if (place > t)
				ans += 2; else
					if ((int) (place+eps) == t)
						ans ++;
		}
		System.out.println(ans);
	}

	public static void main(String[] args) {
		new A15().run();
	}

	BufferedReader in;
	StringTokenizer tokenizer;

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			tokenizer = null;
			Solution();
			in.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	String nextToken() throws IOException {
		while (tokenizer == null || !tokenizer.hasMoreTokens())
			tokenizer = new StringTokenizer(in.readLine());
		return tokenizer.nextToken();
	}
}


import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Prob015A
{
    public static void main( String[] Args )
    {
        Scanner scan = new Scanner( System.in );
        int numHouses = scan.nextInt();
        int side = scan.nextInt() * 2;

        ArrayList<Integer> sides = new ArrayList<Integer>();
        for ( int x = 0; x < numHouses; x++ )
        {
            int c = scan.nextInt() * 2;
            int s = scan.nextInt();

            int l = c - s;
            int r = c + s;

            int li = Collections.binarySearch( sides, l );
            int ri = Collections.binarySearch( sides, r );

            if ( li >= 0 && ri >= 0 )
            {
                sides.remove( li );
                sides.remove( li );
            }
            else if ( li >= 0 )
                sides.set( li, r );
            else if ( ri >= 0 )
                sides.set( ri, l );
            else
            {
                sides.add( -li - 1, r );
                sides.add( -li - 1, l );
            }
        }

        int possibilities = 2;
        for ( int x = 1; x < sides.size() - 1; x += 2 )
            if ( sides.get( x + 1 ) - sides.get( x ) > side )
                possibilities += 2;
            else if ( sides.get( x + 1 ) - sides.get( x ) == side )
                possibilities += 1;

        System.out.println( possibilities );
    }
}


//package round15;

import java.io.BufferedOutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.StringReader;
import java.util.Arrays;
import java.util.Scanner;

public class A {
	private Scanner in;
	private PrintWriter out;

	public void solve()
	{
		int n = ni();
		int t = ni();
		Pair[] p = new Pair[n];
		for(int i = 0;i < n;i++){
			p[i] = new Pair();
			p[i].x = ni();
			p[i].a = ni();
		}
		Arrays.sort(p);

		int ct = 2;
		for(int i = 0;i < n - 1;i++){
			float d = p[i + 1].x - (float)p[i + 1].a / 2 - p[i].x - (float)p[i].a / 2;
			if(Math.abs(d - t) < EPS){
				ct++;
			}else if(d > t){
				ct += 2;
			}
		}

		out.println(ct);
	}

	double EPS = 0.0001;

	private static class Pair implements Comparable<Pair>
	{
		public int x;
		public int a;

		@Override
		public int compareTo(Pair o) {
			return x - o.x;
		}
	}
	public void run() throws Exception
	{
//		in = new Scanner(new StringReader("2 3 0 4 5 2"));
		in = new Scanner(System.in);
		System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		out = new PrintWriter(System.out);

//		int n = in.nextInt();
		int n = 1;
		for(int i = 1;i <= n;i++){
			long t = System.currentTimeMillis();
			solve();
			out.flush();
//			System.err.printf("%04d/%04d %7d%n", i, n, System.currentTimeMillis() - t);
		}
	}

	public static void main(String[] args) throws Exception
	{
		new A().run();
	}

	private int ni() { return Integer.parseInt(in.next()); }
	private static void tr(Object... o) { System.out.println(o.length == 1 ? o[0] : Arrays.toString(o)); }
}


//package round15;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StreamTokenizer;

public class A {

	static StreamTokenizer in =
		new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));

	static int nextInt() throws IOException{
		in.nextToken();
		return (int)in.nval;
	}

	static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) throws IOException{
		int n = nextInt(),
			t = nextInt(),
			x[] = new int[n],
			a[] = new int[n];

		for (int i=0; i<n; i++){
			x[i] = nextInt();
			a[i] = nextInt();
		}

		for (int i=0; i<n-1; i++)
			for (int j=i+1; j<n; j++)
				if (x[i] > x[j]){
					int p = x[i]; x[i] = x[j]; x[j] = p;
						p = a[i]; a[i] = a[j]; a[j] = p;
				}

		double l[] = new double[n];
		double r[] = new double[n];
		for (int i=0; i<n; i++){
			l[i] = x[i]-a[i]/2.0;
			r[i] = x[i]+a[i]/2.0;
		}

		int res = 2;
		for (int i=1; i<n; i++){
			if (Math.abs(l[i]-r[i-1]-t) < 0.000001) res++;
			else if (l[i]-r[i-1] > t) res += 2;
		}

		out.println(res);
		out.flush();
	}

}


import java.io.*;
import java.util.*;

public class Solution {

	private BufferedReader in;
	private PrintWriter out;
	private StringTokenizer st;

	static class House implements Comparable<House> {
		int x, a;

		@Override
		public int compareTo(House o) {
			return x - o.x;
		}

		public House(int x, int a) {
			this.x = x;
			this.a = a;
		}
	}

	void solve() throws IOException {
		int n = nextInt();
		int t = nextInt();
		House[] hs = new House[n];
		for (int i = 0; i < n; ++i) {
			hs[i] = new House(nextInt(), nextInt());
		}
		Arrays.sort(hs);
		int ans = 2;
		for (int i = 0; i < n - 1; ++i) {
			if (hs[i].a + hs[i + 1].a + 2 * t < 2 * (hs[i + 1].x - hs[i].x)) {
				ans += 2;
			} else if (hs[i].a + hs[i + 1].a + 2 * t == 2 * (hs[i + 1].x - hs[i].x)) {
				ans++;
			}
		}
		out.println(ans);
	}

	Solution() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);

		eat("");

		solve();

		in.close();
		out.close();
	}

	private void eat(String str) {
		st = new StringTokenizer(str);
	}

	String next() throws IOException {
		while (!st.hasMoreTokens()) {
			String line = in.readLine();
			if (line == null) {
				return null;
			}
			eat(line);
		}
		return st.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	public static void main(String[] args) throws IOException {
		new Solution();
	}
}


import java.util.Arrays;
import java.util.Scanner;

public class Main {
    static double eps = 1e-8;
    public static void main(String[] args) {
        Scanner r = new Scanner(System.in);

        int n = r.nextInt();
        int t = r.nextInt();

        House[] a = new House[n];
        for(int i = 0; i < n; i++){
            double c = r.nextInt();
            double l = r.nextInt();
            a[i] = new House(c-l/2, l);
        }

        Arrays.sort(a);

        int res = 0;
        for(int i = 0; i < n-1; i++){
            double dist = a[i+1].s - (a[i].s+a[i].l);

            if(Math.abs(dist - t) < eps)res++;
            else if(dist > t)res += 2;
        }

        System.out.println(res+2);
    }
}

class House implements Comparable<House>{
    double s, l;
    public House(double si, double li){
        s = si;
        l = li;
    }
    @Override
    public int compareTo(House b) {
        if(s < b.s)return -1;
        else return 1;
    }
}


//~ 22:04:48
import java.io.*;
import java.util.*;

public class Main{
	public static void main(String[] args) throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		String out = "";
		String[] p = br.readLine().split("[ ]");
		int n = Integer.valueOf(p[0]);
		double t = Double.valueOf(p[1]);

		int offset = 5000;
		boolean[] flags = new boolean[offset+5000];
		for(int i=0;i<n;i++){
			int[] q = toIntArray(br.readLine());
			int c = 2*q[0];
			for(int j=-q[1];j<q[1];j++){
				flags[c+offset+j] = true;
				//~ System.out.println(c+offset+j);
			}
		}
		int buf = 0;
		int last = -1;
		int index = 0;
		for(;index<flags.length;index++){
			if(flags[index]){
				if(last==-1){
					buf++;
				}else{
					//~ System.out.println(last);
					//~ System.out.println(index);
					if(Math.abs(index-last-(2*t+1))<1e-10) buf++;
					else if(index-last>2*t+1) buf+=2;
				}
				last = index;
			}
		}
		buf ++;
		out = ""+buf+"\r\n";
		bw.write(out,0,out.length());
		br.close();
		bw.close();
	}
	static int[] toIntArray(String line){
		String[] p = line.trim().split("\\s+");
		int[] out = new int[p.length];
		for(int i=0;i<out.length;i++) out[i] = Integer.valueOf(p[i]);
		return out;
	}
}


import java.io.*;
import java.util.*;

public class CottageVillage
{
	Scanner in;
	PrintWriter out;

	CottageVillage()
	{
		in = new Scanner(System.in);
		out = new PrintWriter(System.out);
	}

	public void finalize()
	{
		out.flush();
		in.close();
		out.close();
	}

	int ans(House a, House b, int t)
	{
		int diff = b.cordl - a.cordr;

		if(diff < t) return 0;
		if(diff == t) return 1;
		return 2;
	}

	void solve()
	{
		int
			n = in.nextInt(),
			t = in.nextInt() * 2;
		House[] hs = new House[n];

		for(int i = 0; i < n; ++i)
		{
			int
				c = in.nextInt(),
				l = in.nextInt();
			hs[i] = new House(2 * c - l, 2 * c + l);
		}

		Arrays.sort(hs);

		//atleast 2 possible configs
		int co = 2;
		for(int i = 0; i < n - 1; ++i)
			co += ans(hs[i], hs[i + 1], t);

		out.println(co);
	}

	public static void main(String[] args) throws FileNotFoundException
	{
		CottageVillage t = new CottageVillage();
		t.solve();
		t.finalize();
	}
}

class House implements Comparable<House>
{
	public int cordl, cordr;

	public House(int c, int l)
	{
		cordl = c;
		cordr = l;
	}

	@Override
	public int compareTo(House h)
	{
		return cordl - h.cordl;
	}
}


import java.io.*;
import java.util.*;

public class Main implements Runnable {
	class House implements Comparable<House> {
		int x;
		int a;

		public House(int x, int a) {
			this.x = x;
			this.a = a;
		}

		@Override
		public int compareTo(House other) {
			return x - other.x;
		}
	}

	// private void solution() throws IOException {
	// int t = in.nextInt();
	// while (t-- > 0) {
	// int n =in.nextInt();
	// int m = in.nextInt();
	// int x1 = in.nextInt();
	// int y1 = in.nextInt();
	// int x2 = in.nextInt();
	// int y2 = in.nextInt();
	//
	// }
	// }
	private void solution() throws IOException {
		int n = in.nextInt();
		int t = in.nextInt();
		House[] h = new House[n];
		for (int i = 0; i < h.length; ++i) {
			h[i] = new House(in.nextInt(), in.nextInt());
		}
		Arrays.sort(h);
		int res = 2;
		for (int i = 0; i < h.length - 1; ++i) {
			double dist = h[i + 1].x - h[i + 1].a / 2.0 - (h[i].x + h[i].a / 2.0);
			if (dist >= t) {
				if (dist == t) {
					++res;
				} else {
					res += 2;
				}
			}
		}
		out.println(res);
	}

	public void run() {
		try {
			solution();
			in.reader.close();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(-1);
		}
	}

	private class Scanner {
		private BufferedReader reader;
		private StringTokenizer tokenizer;

		public Scanner(Reader reader) {
			this.reader = new BufferedReader(reader);
			this.tokenizer = new StringTokenizer("");
		}

		public boolean hasNext() throws IOException {
			while (!tokenizer.hasMoreTokens()) {
				String next = reader.readLine();
				if (next == null) {
					return false;
				}
				tokenizer = new StringTokenizer(next);
			}
			return true;
		}

		public String next() throws IOException {
			hasNext();
			return tokenizer.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public String nextLine() throws IOException {
			tokenizer = new StringTokenizer("");
			return reader.readLine();
		}
	}

	public static void main(String[] args) throws IOException {
		new Thread(null, new Main(), "", 1 << 28).start();
	}
	PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	Scanner in = new Scanner(new InputStreamReader(System.in));
}


import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

public class a {

	private void solve() throws Exception {
		int n = nextInt(), t = nextInt();
		int[] x = new int[n], a = new int[n];
		for (int i = 0; i < n; ++i){
			x[i] = nextInt();
			a[i] = nextInt();
		}
		for (int i = 0; i < n; ++i)
			for (int j = 0; j < n - 1; ++j){
				if (x[j] > x[j + 1]){
					int tmp = x[j];
					x[j] = x[j + 1];
					x[j + 1] = tmp;

					tmp = a[j];
					a[j] = a[j + 1];
					a[j + 1] = tmp;
				}
			}
		int res = 2;
		for (int i = 1; i < n; ++i){
			int betw = (x[i] - x[i - 1]) * 2 - a[i] - a[i - 1];
			if (betw == t * 2)
				++res;
			else if (betw > t * 2)
				res += 2;
		}
		out.print(res);
	}

	public void run() {
		try {
			solve();
		} catch (Exception e) {
			NOO(e);
		} finally {
			out.close();
		}
	}

	PrintWriter out;
	BufferedReader in;
	StringTokenizer St;

	void NOO(Exception e) {
		e.printStackTrace();
		System.exit(1);
	}

	int nextInt() {
		return Integer.parseInt(nextToken());
	}

	long nextLong() {
		return Long.parseLong(nextToken());
	}

	double nextDouble() {
		return Double.parseDouble(nextToken());
	}

	String nextToken() {
		while (!St.hasMoreTokens()) {
			try {
				String line = in.readLine();
				St = new StringTokenizer(line);
			} catch (Exception e) {
				NOO(e);
			}
		}
		return St.nextToken();
	}

	private a(String name) {
		try {
			in = new BufferedReader(new FileReader(name + ".in"));
			St = new StringTokenizer("");
			out = new PrintWriter(new FileWriter(name + ".out"));
		} catch (Exception e) {
			NOO(e);
		}
	}

	private a() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			St = new StringTokenizer("");
			out = new PrintWriter(System.out);
		} catch (Exception e) {
			NOO(e);
		}
	}

	public static void main(String[] args) {
		new a().run();
	}

}


import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class Main {
    BufferedReader in;
    PrintWriter out;
    StringTokenizer st;

    void solve() throws IOException {
        int n=ni();//have bult yet
        int t=ni();//new house

        int[] center=new int[n];
        int[] width=new int[n];
        for(int i=0;i<n;i++){
            center[i]=ni();
            width[i]=ni();
        }
        for(int i=0;i<n;i++){
            for(int j=i;j<n;j++){
                if(center[i]>center[j]){
                    int cent=center[i];
                    int wid=width[i];
                    center[i]=center[j];
                    width[i]=width[j];
                    center[j]=cent;
                    width[j]=wid;
                }
            }
        }
        int count=2;
        for(int i=0;i<n-1;i++){
            //min way
            double ideal=(double)width[i]/2+(double)width[i+1]/2+t;

            //real way
            double real=center[i+1]-center[i];
            //out.println(ideal);
            //out.println(real);
            if(ideal==real)count++;
            else{
                if(ideal<real)count=count+2;
            }
        }
        out.println(count);

    }

    public Main() throws IOException {
        Locale.setDefault(Locale.US);
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        in.close();
        out.close();
    }

    String ns() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    int ni() throws IOException {
        return Integer.valueOf(ns());
    }

    long nl() throws IOException {
        return Long.valueOf(ns());
    }

    double nd() throws IOException {
        return Double.valueOf(ns());
    }

    public static void main(String[] args) throws IOException {
        new Main();
    }
}


import java.awt.Point;
import java.io.*;
import java.util.*;
import static java.lang.Math.*;

public class ProblemA_15 {

    final boolean ONLINE_JUDGE=System.getProperty("ONLINE_JUDGE")!=null;
    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok=new StringTokenizer("");

    void init() throws FileNotFoundException{
        if (ONLINE_JUDGE){
            in=new BufferedReader(new InputStreamReader(System.in));
            out =new PrintWriter(System.out);
        }
        else{
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        }
    }

    String readString() throws IOException{
        while(!tok.hasMoreTokens()){
            tok=new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    int readInt() throws IOException{
        return Integer.parseInt(readString());
    }

    public static void main(String[] args){
        new ProblemA_15().run();
    }

    public void run(){
        try{
            long t1=System.currentTimeMillis();
            init();
            solve();
            out.close();
            long t2=System.currentTimeMillis();
            System.err.println("Time = "+(t2-t1));
        }catch (Exception e){
            e.printStackTrace(System.err);
            System.exit(-1);
        }
    }

    void solve() throws IOException{
        int n=readInt();
        int t=readInt();
        Point[] a=new Point[n];
        for (int i=0; i<n; i++){
            a[i]=new Point(readInt(), readInt());
        }
        int count=2;
        Arrays.sort(a, new Comparator<Point>(){

            @Override
            public int compare(Point p1, Point p2) {
                return p1.x-p2.x;
            }

        });
        for (int i=1; i<n; i++){
            double li=a[i-1].x+(double)a[i-1].y/2;
            double ri=a[i].x-(double)a[i].y/2;
            if (ri-li>t){
                count+=2;
            }
            if (ri-li==t){
                count++;
            }
        }
        out.print(count);
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer split = new StringTokenizer(in.readLine());
        int n = Integer.parseInt(split.nextToken());
        double t = Double.parseDouble(split.nextToken());

        House[] xaxis = new House[n];

        for (int i = 0; i < n; i++) {
            split = new StringTokenizer(in.readLine());
            xaxis[i] = new House(Double.parseDouble(split.nextToken()), Double.parseDouble(split.nextToken()));
        }
        Arrays.sort(xaxis);
        int count = 2;
        for (int i = 0; i < xaxis.length - 1; i++) {
            double free = (xaxis[i + 1].getX() - xaxis[i + 1].getSize() / 2.0) - (xaxis[i].getX() + xaxis[i].getSize() / 2.0);
            if (free / t == 1.0) {
                count++;
            } else if (free / t > 1.0) {
                count += 2;
            }
        }

        System.out.println(count);
    }
}

class House implements Comparable<House> {

    private double x;
    private double size;

    public House(double x, double size) {
        this.x = x;
        this.size = size;
    }

    public double getX() {
        return x;
    }

    public double getSize() {
        return size;
    }

    public int compareTo(House o) {
        if (this.x > o.getX()) {
            return 1;
        } else if (this.x == o.getX()) {
            return 0;
        }
        return -1;
    }
}


import java.util.Arrays;
import java.util.Scanner;

public class Main {
    private static Node[] node;

    public static void main(String[] args) {
    Scanner cin = new Scanner(System.in);
    int ret = 2, del;
    int n = cin.nextInt();
    int t = cin.nextInt() * 2;
    node = new Node[n];
    for (int i = 0; i < n; i++) {
        int x = cin.nextInt();
        int a = cin.nextInt();
        node[i] = new Node(x * 2 - a, x * 2 + a);
    }
    Arrays.sort(node);
    for (int i = 1; i < n; i++) {
        del = node[i].l - node[i - 1].r;
        if (del > t) {
        ret += 2;
        } else if (del == t) {
        ret++;
        }
    }
    System.out.println(ret);
    }

    private static class Node implements Comparable<Node> {
    public int l;
    public int r;

    public Node(int l, int r) {
        // TODO Auto-generated constructor stub
        this.l = l;
        this.r = r;
    }

    @Override
    public int compareTo(Node arg0) {
        // TODO Auto-generated method stub
        return l - arg0.l;
    }
    }
}


import java.util.*;
import java.io.*;
public class Main
{
	public static void main(String args[]) throws IOException
	{
		Scanner sc = new Scanner(System.in/*new File("input.txt")*/);
		int n = sc.nextInt(), t = sc.nextInt(), x, a, kol = 2;
		ArrayList<Double> al = new ArrayList<Double>();
		for(int i=0;i<n;i++)
		{
			x = sc.nextInt();
			a = sc.nextInt();
			al.add(x - a/2.);
			al.add(x + a/2.);
		}
		Collections.sort(al);
		double d0 = 0; int k = 0, kn = al.size();
		for(Double d: al)
		{
			if (k == 2)
			{
				if (d-d0>t) kol+=2; else
				if (d-d0==t) kol++;
				d0 = d;
				k = 1;
			} else
			{
				k++;
				d0 = d;
			}
		}
		System.out.print(kol);
	}
}


import java.io.*;
import java.util.*;
import static java.lang.Math.*;

public class BetaRound15_A implements Runnable {

	final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok = new StringTokenizer("");

	void init() throws IOException {
		if (ONLINE_JUDGE) {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		} else {
			in = new BufferedReader(new FileReader("input.txt"));
			out = new PrintWriter("output.txt");
		}
	}

	String readString() throws IOException {
		while (!tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	int readInt() throws IOException {
		return Integer.parseInt(readString());
	}

	@Override
	public void run() {
		try {
			long t1 = System.currentTimeMillis();
			init();
			solve();
			out.close();
			long t2 = System.currentTimeMillis();
			System.err.println("Time = " + (t2 - t1));
		} catch (Exception e) {
			e.printStackTrace(System.err);
			System.exit(-1);
		}
	}

	public static void main(String[] args) {
		new Thread(new BetaRound15_A()).start();
	}

	class House implements Comparable<House> {
		int left, right;
		House(int left, int right) {
			this.left = left;
			this.right = right;
		}
		@Override
		public int compareTo(House h) {
			return this.left - h.left;
		}
	}

	int getAns(House h1, House h2, int t) {
		int d = h2.left - h1.right;
		if (d < t) return 0;
		if (d == t) return 1;
		return 2;
	}

	void solve() throws IOException {
		int n = readInt();
		int t = readInt() * 2;
		House[] h = new House[n];
		for (int i = 0; i < n; i++) {
			int c = readInt() * 2;
			int b = readInt();
			h[i] = new House(c - b, c + b);
		}
		Arrays.sort(h);
		int ans = 2;
		for (int i = 1; i < n; i++) {
			ans += getAns(h[i - 1], h[i], t);
		}
		out.print(ans);
	}
}


import java.util.*;
import java.awt.*;

public class A
{
	static Comparator<Point> cmp = new Comparator<Point>()
	{
		public int compare(Point a, Point b)
		{
			if(a.x < b.x)
				return -1;
			else if(a.x > b.x)
				return 1;

			return 0;
		}
	};

	public static void main(String args[])
	{
		Scanner scan = new Scanner(System.in);

		while(scan.hasNextInt())
		{

		int n = scan.nextInt();
		int k = scan.nextInt();

		Point[] a = new Point[n];

		for(int i=0;i < n;i++)
		{
			a[i] = new Point();
			a[i].x = scan.nextInt();
			a[i].y = scan.nextInt();
		}

		Arrays.sort(a, cmp);

		int rtn = 0;

		ArrayList<Double> ans = new ArrayList<Double>();

		for(int i=0;i < n;i++)
		{
			//Left
			double lb = a[i].x - (a[i].y / 2.0) - k;
			double pos = lb + (k/2.0);
			boolean good = true;

			for(int j=0;j < ans.size();j++)
				if(Math.abs(ans.get(j) - pos) < 0.0000001)
					good = false;

			if(good && (i == 0 || a[i-1].x + (a[i-1].y / 2.0) <= lb))
			{
				rtn++;
				ans.add(pos);
			}

			double rb = a[i].x + (a[i].y / 2.0) + k;
			pos = rb - (k/2.0);
			good = true;

			for(int j=0;j < ans.size();j++)
				if(Math.abs(ans.get(j) - pos) < 0.0000001)
					good = false;

			if(good && (i == n-1 || a[i+1].x - (a[i+1].y / 2.0) >= rb))
			{
				rtn++;
				ans.add(pos);
			}
		}

		System.out.println(rtn);
		}
	}
}


import java.text.*;
import java.util.*;

public class A {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int t = scan.nextInt();
		List<Double> coords = new ArrayList<Double>();
		while (n-- > 0) {
			double x = scan.nextDouble();
			double a = scan.nextDouble() / 2;
			coords.add(x - a);
			coords.add(x + a);
		}
		Collections.sort(coords);
		int count = 2;
		ChoiceFormat f = new ChoiceFormat("-1#0|0#1|0<2");
		for (int i = 1; i < coords.size()-2; i+=2) {
			count += new Integer(f.format(coords.get(i+1)-coords.get(i)-t));
		}
		System.out.println(count);
	}
}


import java.awt.Point;
import java.awt.geom.Point2D;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class A {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int t = in.nextInt() * 2;
        Point[] A = new Point[n];
        for (int i = 0; i < n; i++) {
            int center = in.nextInt() * 2;
            int side = in.nextInt();
            A[i] = new Point(center - side, center + side);
        }
        Arrays.sort(A, new Comparator<Point>() {
            public int compare(Point x, Point y) {
                return x.x - y.x;
            }
        });
        int ans = 2;
        for (int i = 1; i < n; i++) {
            if (A[i].x - A[i - 1].y > t)
                ans += 2;
            else if (A[i].x - A[i - 1].y == t)
                ans++;
        }
        System.out.println(ans);
    }
}


import java.util.*;

public class main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int houses = sc.nextInt();
        int size = sc.nextInt();
        hizzy[] array = new hizzy[houses];
        long total =2;
        for(int a=0;a<houses;a++)array[a]=new hizzy(sc.nextInt(),sc.nextInt());
        Arrays.sort(array);
        for(int a=0;a<houses-1;a++){
            double L = array[a].loc+array[a].size/2;
            double R = array[a+1].loc-array[a+1].size/2;
            if(R-L>size)total+=2;
            else if((R-L)==size)total++;
        }
        System.out.println(total);
    }

}
class hizzy implements Comparable{
    double loc;
    double size;
    hizzy(double l, double s){
        this.loc=l;
        this.size=s;
    }

    public int compareTo(Object o) {
        hizzy other = (hizzy) o;
        return (int) (this.loc-other.loc);
    }

}


import java.util.*;

public class Village {

	private class House implements Comparable<House> {
		Double Coordinate;
		Double Sidelength;

		private House(double coordinate, double sidelength) {
			Coordinate = coordinate;
			Sidelength = sidelength;
		}

		public int compareTo(House o) {
			return Coordinate.compareTo(o.Coordinate);
		}
	}

	private void solve() {
		Scanner in = new Scanner(System.in);
		in.next();
		double requireside = in.nextDouble();
		ArrayList<House> coordinate = new ArrayList<House>();
		while (in.hasNext()) {
			double coo = in.nextDouble();
			double side = in.nextDouble();
			coordinate.add(new House(coo, side));
		}
		Collections.sort(coordinate);
		ArrayList<Double> edges = new ArrayList<Double>();
		int count = 2;
		for (int i = 0; i < coordinate.size(); i++) {
			edges.add(coordinate.get(i).Coordinate
					- (double) coordinate.get(i).Sidelength / (double) 2);
			edges.add(coordinate.get(i).Coordinate
					+ (double) coordinate.get(i).Sidelength / (double) 2);
		}
		ArrayList<Double> difference = new ArrayList<Double>();
		for (int i = 1; i < edges.size() - 1; i++) {
			difference.add(Math.abs(edges.get(i) - edges.get(i + 1)));
		}
		for (int i = 0; i < difference.size(); i += 2) {
			if (difference.get(i) == requireside)
				count++;
			else if (difference.get(i) > requireside)
				count += 2;
		}
		System.out.println(count);
	}

	public static void main(String args[]) {
		Village v = new Village();
		v.solve();
	}
}


import java.util.*;

public class A
{
   public static void main(String[] args)
   {
      new A(new Scanner(System.in));
   }

   public A(Scanner in)
   {
      int n = in.nextInt();
      int t = in.nextInt();
      int tt = 2*t;

      rect[] rs = new rect[n];
      for (int i=0; i<n; i++)
         rs[i] = new rect(in.nextInt(), in.nextInt());

      Arrays.sort(rs);

      int res = 2;
      for (int i=1; i<n; i++)
      {
         rect a = rs[i-1];
         rect b = rs[i];
         int d = b.p-a.p;
         int dd = a.t+b.t;
         int tv = 2*d-dd;
         if (tt == tv)
            res++;
         if (tv > tt)
            res+=2;
      }
      System.out.printf("%d%n", res);
   }
}

class rect implements Comparable<rect>
{
   int p;
   int t;

   public rect(int pp, int tt)
   {
      p = pp;
      t = tt;
   }

   public int compareTo(rect rhs)
   {
      return p-rhs.p;
   }
}


import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.*;

public class Main implements Runnable {

    class Home implements Comparable<Home> {
        @Override
        public int compareTo(Home arg0) {
            return st - arg0.st;
        }

        int st, end;

    }

    public void solve() throws IOException {
        int n = nextInt(), t = nextInt() * 2;
        Home[] h = new Home[n];
        for(int i = 0; i < n; ++i) {
            int x = nextInt() * 2, a = nextInt() * 2;
            h[i] = new Home();
            h[i].st = x - a / 2;
            h[i].end = x + a / 2;
        }
        Arrays.sort(h);
        int ans = 2;
        for(int i = 0; i + 1 < n; ++i) {
            int delta = h[i + 1].st - h[i].end;
            if (delta == t)
                ans++;
            if (delta > t)
                ans += 2;
        }
        pw.println(ans);
    }

    static final String filename = "A";
    static final boolean fromConsole = true;

    public void run() {
        try {
            if (!fromConsole) {
                in = new BufferedReader(new FileReader(filename + ".in"));
                pw = new PrintWriter(filename + ".out");
            } else {
                in = new BufferedReader(new InputStreamReader(System.in));
                pw = new PrintWriter(System.out);
            }
            st = new StringTokenizer("");
            long st = System.currentTimeMillis();
            solve();
            //pw.printf("\nWorking time: %d ms\n", System.currentTimeMillis() - st);
            pw.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(-1);
        }
    }

    private StringTokenizer st;
    private BufferedReader in;
    private PrintWriter pw;

    boolean hasNext() throws IOException {
        while (!st.hasMoreTokens()) {
            String line = in.readLine();
            if (line == null) {
                return false;
            }
            st = new StringTokenizer(line);
        }
        return st.hasMoreTokens();
    }

    String next() throws IOException {
        return hasNext() ? st.nextToken() : null;
    }

    int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    BigInteger nextBigInteger() throws IOException {
        return new BigInteger(next());
    }

    long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    public static void main(String[] args) {
        new Thread(new Main()).start();
    }
}


import java.util.*;

public class A {
	Scanner in = new Scanner(System.in);

	public class Houses implements Comparable<Houses>{
		double x;
		double a;

		public Houses(double xVal, double aVal){
			x = xVal-aVal/2;
			a = aVal;
		}

		@Override
		public int compareTo(Houses o) {
			return (int) (x - o.x);
		}
	}

	public void solve2(ArrayList<Houses> list,int t){
		Collections.sort(list);
		int count = 2; //beginning and end

		for(int f = 0; f < list.size()-1; f++){

			if(list.get(f+1).x-list.get(f).x-list.get(f).a > t){
				count+=2;
			}
			else if(list.get(f+1).x-list.get(f).x-list.get(f).a == t){
				count++;
			}

		}

		System.out.println(count);
	}

	public void solve(){
		ArrayList<Houses> list = new ArrayList<Houses>();
		int n = in.nextInt();
		int t = in.nextInt();
		for(int i = 0; i < n; i++){
			list.add(new Houses(in.nextDouble(),in.nextDouble()));
		}

		solve2(list,t);
	}

	public static void main(String[] args){
		A p = new A();
		p.solve();
	}
}


import java.io.*;
import java.math.*;
import java.util.*;

public class Village
{
	static Scanner in = new Scanner( new BufferedReader( new InputStreamReader( System.in ) ) );

	public static void main( String[] args )
	{
		int n = in.nextInt(), t = 2*in.nextInt(), h[][] = new int[n][2], ans = 2;
		for( int i = 0; i < n; i++ )
		{
			h[i][0] = 2*in.nextInt();
			h[i][1] = in.nextInt();
		}
		Arrays.sort( h, new Comp() );
		for( int i = 1; i < n; i++ )
		{
			int d = (h[i][0]-h[i][1])-(h[i-1][0]+h[i-1][1]);
			if( d>t ) ans += 2;
			if( d==t ) ans++;
		}
		System.out.println( ans );
	}

	static class Comp implements Comparator<int[]>
	{
		public int compare( int[] a, int[] b ) { return a[0]-b[0]; }
	}
}


import java.io.*;
import java.util.*;

public class A implements Runnable {
	public static void main(String[] args) {
		new A().run();
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;
		boolean eof;
		String buf;

		public FastScanner(String fileName) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(fileName));
			nextToken();
		}

		public FastScanner(InputStream stream) {
			br = new BufferedReader(new InputStreamReader(stream));
			nextToken();
		}

		String nextToken() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception e) {
					eof = true;
					break;
				}
			}
			String ret = buf;
			buf = eof ? "-1" : st.nextToken();
			return ret;
		}

		int nextInt() {
			return Integer.parseInt(nextToken());
		}

		long nextLong() {
			return Long.parseLong(nextToken());
		}

		double nextDouble() {
			return Double.parseDouble(nextToken());
		}

		void close() {
			try {
				br.close();
			} catch (Exception e) {

			}
		}

		boolean isEOF() {
			return eof;
		}
	}

	FastScanner sc;
	PrintWriter out;

	public void run() {
		Locale.setDefault(Locale.US);
		try {
			sc = new FastScanner(System.in);
			out = new PrintWriter(System.out);
			solve();
			sc.close();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	int nextInt() {
		return sc.nextInt();
	}

	String nextToken() {
		return sc.nextToken();
	}

	long nextLong() {
		return sc.nextLong();
	}

	double nextDouble() {
		return sc.nextDouble();
	}

	class House {
		int x, t;

		public House(int x, int t) {
			this.x = x;
			this.t = t;
		}

	}

	void solve() {
		int n = nextInt();
		int t = nextInt();
		House[] h = new House[n];
		for (int i = 0; i < n; i++) {
			h[i] = new House(nextInt(), nextInt());
		}
		Arrays.sort(h, new Comparator<House>() {
			@Override
			public int compare(House o1, House o2) {
				return o1.x < o2.x ? -1 : o1.x > o2.x ? 1 : 0;
			}
		});
		int ans = 0;
		for (int i = 0; i < n; i++) {
			if (i == 0
					|| (h[i].x - h[i - 1].x) * 2 - h[i].t - h[i - 1].t >= 2 * t) {
				++ans;
			}
			if (i == n - 1
					|| (h[i + 1].x - h[i].x) * 2 - h[i + 1].t - h[i].t > 2 * t) {
				++ans;
			}
		}
		out.println(ans);
	}
}


import java.text.ChoiceFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class A {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int t = scan.nextInt();
		List<List<Double>> coords = new ArrayList<List<Double>>();
		while (n-- > 0) {
			double x = scan.nextDouble();
			double a = scan.nextDouble() / 2;
			coords.add(Arrays.asList(x - a, x + a));
		}
		Collections.sort(coords, new Comparator<List<Double>>() {
			@Override
			public int compare(List<Double> o1, List<Double> o2) {
				return o1.get(0).compareTo(o2.get(0));
			}
		});
		int count = 2;
		ChoiceFormat f = new ChoiceFormat("-1#0|0#1|0<2");
		for (int i = 0; i < coords.size()-1; i++) {
			double l = coords.get(i+1).get(0)-coords.get(i).get(1)-t;
			count += new Integer(f.format(l));
		}
		System.out.println(count);
	}
}


import java.lang.*;
import java.io.*;
import java.util.*;
import java.math.*;

public class Solution  implements Runnable{
    private static BufferedReader br = null;
    private static PrintWriter out = null;
    private static StringTokenizer stk = null;

    public static void main(String[] args) {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
       (new Thread(new Solution())).start();
    }

    private void loadLine() {
        try {
            stk = new StringTokenizer(br.readLine());
        }
        catch (IOException e) {
            e.printStackTrace();
        }
    }

    private String nextLine() {
        try {
            return br.readLine();
        }
        catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }

    private Integer nextInt() {
        while (stk==null||!stk.hasMoreTokens()) loadLine();
        return Integer.parseInt(stk.nextToken());
    }

    private Long nextLong() {
        while (stk==null||!stk.hasMoreTokens()) loadLine();
        return Long.parseLong(stk.nextToken());
    }

    private String nextWord() {
        while (stk==null||!stk.hasMoreTokens()) loadLine();
        return (stk.nextToken());
    }

    private Double nextDouble() {
        while (stk==null||!stk.hasMoreTokens()) loadLine();
        return Double.parseDouble(stk.nextToken());
    }

    public void run() {
        int n = nextInt();
        int t = nextInt();

        double[] d = new double[2*n];
        for (int i = 0; i < n; ++i) {
            double x = nextDouble();
            double a = nextDouble();
            d[2*i] = x-a/2;
            d[2*i+1] = x+a/2;
        }

        Arrays.sort(d);
        int res = 2;
        for (int i = 1; i < 2*n-1; i+=2) {
            if (d[i+1] - d[i] >= t) {
                ++res;
            }
            if (d[i+1] - d[i] > t) {
                ++res;
            }
        }

        out.println(res);
        out.flush();
    }
}


import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

public class CodeForces {

	public void solve() throws IOException {
		int n=nextInt();
		int t=nextInt();
		double larr[]=new double [n];
		double rarr[]=new double [n];
		for(int i=0;i<n;i++){
			double x=nextDouble();
			double r=nextDouble();
			larr[i]=x-r/2;
			rarr[i]=x+r/2;
		}
		Arrays.sort(larr);
		Arrays.sort(rarr);

		int counter=2;
		for(int i=1;i<n;i++){
			if(larr[i]-rarr[i-1]>t){
				counter+=2;
			} else if(larr[i]-rarr[i-1]==t){
				counter++;
			}
		}

		writer.print(counter);
	}

	public static void main(String[] args) {
		new CodeForces().run();
	}

	BufferedReader reader;
	StringTokenizer tokenizer;
	PrintWriter writer;

	public void run() {
		try {
			reader = new BufferedReader(new InputStreamReader(System.in));
			//reader = new BufferedReader(new FileReader("input.txt"));
			tokenizer = null;
			writer = new PrintWriter(System.out);
			//writer = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
			// long t=new Date().getTime();
			solve();
			// writer.println(t-new Date().getTime());
			reader.close();
			writer.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	String nextToken() throws IOException {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			tokenizer = new StringTokenizer(reader.readLine());
		}
		return tokenizer.nextToken();
	}
}


import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Locale;
import java.util.StringTokenizer;

public class Solution implements Runnable {

	public static void main(String[] args) {
		(new Thread(new Solution())).start();
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st;

	String nextToken() throws IOException {
		while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	class Dom implements Comparable<Dom>{
		int x, a;

		public int compareTo(Dom o) {
			return x - o.x;
		}
	}

	void solve() throws Exception {
		int n = nextInt();
		int t = nextInt() * 2;
		Dom[] a = new Dom[n];
		for (int i = 0; i < n; i++) {
			a[i] = new Dom();
			a[i].x = nextInt() * 2;
			a[i].a = nextInt();
		}
		Arrays.sort(a);
		int ans = 2;
		for (int i = 0; i < n - 1; i++) {
			if (t < a[i + 1].x - a[i + 1].a - a[i].x - a[i].a) ans += 2;
			if (t == a[i + 1].x - a[i + 1].a - a[i].x - a[i].a) ans += 1;
		}
		out.print(ans);
	}

	public void run() {
		try {
			Locale.setDefault(Locale.US);
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			solve();
		} catch (Exception e) {
			e.printStackTrace();
		}
		out.flush();
	}

}


import java.io.*;
import java.util.Arrays;
import java.util.Random;
import java.util.StringJoiner;
import java.util.StringTokenizer;
import java.util.concurrent.ThreadLocalRandom;
import java.util.function.Function;

public class Main {

    static int T;

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        T = sc.nextInt();

        PrintWriter pw = new PrintWriter(System.out);
        for (int i = 0; i < T; i++) {
            int n = sc.nextInt();
            int[] a = sc.nextIntArray(n);
            int[] ans = solve(n, a);
            StringJoiner j = new StringJoiner(" ");
            for (int each : ans) {
                j.add(String.valueOf(each));
            }
            pw.println(j.toString());
        }
        pw.flush();
    }

    static int[] solve(int N, int[] A) {
        // a/b が1に近いものを探す
        shuffle(A);
        Arrays.sort(A);
        int cur = A[0];
        int time = 1;
        double r = 0;
        int prev = -1;
        int a = -1;
        int b = -1;
        for (int i = 1; i < N; i++) {
            if( cur == A[i] ) {
                time++;

                if( time == 2 ) {
                    if( prev != -1 ) {
                        double r1 = (double)prev/cur;
                        if( r1 > r ) {
                            r = r1;
                            a = prev;
                            b = cur;
                        }
                    }
                    prev = cur;
                }

                if( time == 4 ) {
                    return new int[]{cur, cur, cur, cur};
                }

            } else {
                time = 1;
                cur = A[i];
            }
        }

        return new int[]{a, a, b, b};
    }

    static void shuffle(int[] a) {
        Random r = ThreadLocalRandom.current();
        for (int i = a.length-1; i >= 0; i--) {
            int j = r.nextInt(i+1);
            int t = a[i];
            a[i] = a[j];
            a[j] = t;
        }
    }

    @SuppressWarnings("unused")
    static class FastScanner {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken("\n");
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        int[] nextIntArray(int n, int delta) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt() + delta;
            return a;
        }

        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }

    static <A> void writeLines(A[] as, Function<A, String> f) {
        PrintWriter pw = new PrintWriter(System.out);
        for (A a : as) {
            pw.println(f.apply(a));
        }
        pw.flush();
    }

    static void writeLines(int[] as) {
        PrintWriter pw = new PrintWriter(System.out);
        for (int a : as) pw.println(a);
        pw.flush();
    }

    static void writeLines(long[] as) {
        PrintWriter pw = new PrintWriter(System.out);
        for (long a : as) pw.println(a);
        pw.flush();
    }

    static int max(int... as) {
        int max = Integer.MIN_VALUE;
        for (int a : as) max = Math.max(a, max);
        return max;
    }

    static int min(int... as) {
        int min = Integer.MAX_VALUE;
        for (int a : as) min = Math.min(a, min);
        return min;
    }

    static void debug(Object... args) {
        StringJoiner j = new StringJoiner(" ");
        for (Object arg : args) {
            if (arg instanceof int[]) j.add(Arrays.toString((int[]) arg));
            else if (arg instanceof long[]) j.add(Arrays.toString((long[]) arg));
            else if (arg instanceof double[]) j.add(Arrays.toString((double[]) arg));
            else if (arg instanceof Object[]) j.add(Arrays.toString((Object[]) arg));
            else j.add(arg.toString());
        }
        System.err.println(j.toString());
    }
}


import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class Sockets {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int n = in.nextInt(), m = in.nextInt(), socket = in.nextInt();
        int[] filters = new int[n];

        for (int i = 0; i < n; i++ ) {
            filters[i] = in.nextInt();
        }
        Arrays.sort(filters);

        int result = 0, index = n - 1;
        while ( m > socket && index >= 0) {
            socket += filters[index] - 1;
            result += 1;
            index -= 1;
        }

        out.println(m > socket ? -1 : result);
        out.close();
    }
}


import java.io.*;
import java.util.*;
import static java.lang.Math.*;

public class A implements Runnable {

	final boolean LOCAL = System.getProperty("ONLINE_JUDGE") == null;

	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok;

	public static void main(String[] args) {
		new Thread(null, new A(), "", 256*1024*1024).start();
	}

	public void run() {
		try {
			long t1 = 0, t2 = 0, m1 = 0, m2 = 0;
			if (LOCAL) {
				t1 = System.currentTimeMillis();
				m1 = Runtime.getRuntime().freeMemory();
			}
			Locale.setDefault(Locale.US);
			if (LOCAL) {
				in = new BufferedReader(new FileReader("input.txt"));
				out = new PrintWriter("output.txt");
			} else {
				in = new BufferedReader(new InputStreamReader(System.in));
				out = new PrintWriter(System.out);
			}
			tok = new StringTokenizer("");
			solve();
			in.close();
			out.close();
			if (LOCAL) {
				t2 = System.currentTimeMillis();
				m2 = Runtime.getRuntime().freeMemory();
				System.err.println("Time = " + (t2 - t1) + " ms.");
				System.err.println("Memory = " + ((m1 - m2) / 1024) + " KB.");
			}
		} catch (Throwable e) {
			e.printStackTrace(System.err);
			throw new RuntimeException();
		}
	}

	String readString() throws IOException {
		while (!tok.hasMoreTokens()) {
			String line = in.readLine();
			if (line == null) return null;
			tok = new StringTokenizer(line);
		}
		return tok.nextToken();
	}

	int readInt() throws IOException {
		return Integer.parseInt(readString());
	}

	long readLong() throws IOException {
		return Long.parseLong(readString());
	}

	double readDouble() throws IOException {
		return Double.parseDouble(readString());
	}

	static class Mergesort {

		private Mergesort() {}

		public static void sort(int[] a) {
			mergesort(a, 0, a.length - 1);
		}

		public static void sort(long[] a) {
			mergesort(a, 0, a.length - 1);
		}

		public static void sort(double[] a) {
			mergesort(a, 0, a.length - 1);
		}

		private static final int MAGIC_VALUE = 42;

		private static void mergesort(int[] a, int leftIndex, int rightIndex) {
			if (leftIndex < rightIndex) {
				if (rightIndex - leftIndex <= MAGIC_VALUE) {
					insertionSort(a, leftIndex, rightIndex);
				} else {
					int middleIndex = (leftIndex + rightIndex) / 2;
					mergesort(a, leftIndex, middleIndex);
					mergesort(a, middleIndex + 1, rightIndex);
					merge(a, leftIndex, middleIndex, rightIndex);
				}
			}
		}

		private static void mergesort(long[] a, int leftIndex, int rightIndex) {
			if (leftIndex < rightIndex) {
				if (rightIndex - leftIndex <= MAGIC_VALUE) {
					insertionSort(a, leftIndex, rightIndex);
				} else {
					int middleIndex = (leftIndex + rightIndex) / 2;
					mergesort(a, leftIndex, middleIndex);
					mergesort(a, middleIndex + 1, rightIndex);
					merge(a, leftIndex, middleIndex, rightIndex);
				}
			}
		}

		private static void mergesort(double[] a, int leftIndex, int rightIndex) {
			if (leftIndex < rightIndex) {
				if (rightIndex - leftIndex <= MAGIC_VALUE) {
					insertionSort(a, leftIndex, rightIndex);
				} else {
					int middleIndex = (leftIndex + rightIndex) / 2;
					mergesort(a, leftIndex, middleIndex);
					mergesort(a, middleIndex + 1, rightIndex);
					merge(a, leftIndex, middleIndex, rightIndex);
				}
			}
		}

		private static void merge(int[] a, int leftIndex, int middleIndex, int rightIndex) {
			int length1 = middleIndex - leftIndex + 1;
			int length2 = rightIndex - middleIndex;
			int[] leftArray = new int[length1];
			int[] rightArray = new int[length2];
			System.arraycopy(a, leftIndex, leftArray, 0, length1);
			System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);
			for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {
				if (i == length1) {
					a[k] = rightArray[j++];
				} else if (j == length2) {
					a[k] = leftArray[i++];
				} else {
					a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];
				}
			}
		}

		private static void merge(long[] a, int leftIndex, int middleIndex, int rightIndex) {
			int length1 = middleIndex - leftIndex + 1;
			int length2 = rightIndex - middleIndex;
			long[] leftArray = new long[length1];
			long[] rightArray = new long[length2];
			System.arraycopy(a, leftIndex, leftArray, 0, length1);
			System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);
			for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {
				if (i == length1) {
					a[k] = rightArray[j++];
				} else if (j == length2) {
					a[k] = leftArray[i++];
				} else {
					a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];
				}
			}
		}

		private static void merge(double[] a, int leftIndex, int middleIndex, int rightIndex) {
			int length1 = middleIndex - leftIndex + 1;
			int length2 = rightIndex - middleIndex;
			double[] leftArray = new double[length1];
			double[] rightArray = new double[length2];
			System.arraycopy(a, leftIndex, leftArray, 0, length1);
			System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);
			for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {
				if (i == length1) {
					a[k] = rightArray[j++];
				} else if (j == length2) {
					a[k] = leftArray[i++];
				} else {
					a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];
				}
			}
		}

		private static void insertionSort(int[] a, int leftIndex, int rightIndex) {
			for (int i = leftIndex + 1; i <= rightIndex; i++) {
				int current = a[i];
				int j = i - 1;
				while (j >= leftIndex && a[j] > current) {
					a[j + 1] = a[j];
					j--;
				}
				a[j + 1] = current;
			}
		}

		private static void insertionSort(long[] a, int leftIndex, int rightIndex) {
			for (int i = leftIndex + 1; i <= rightIndex; i++) {
				long current = a[i];
				int j = i - 1;
				while (j >= leftIndex && a[j] > current) {
					a[j + 1] = a[j];
					j--;
				}
				a[j + 1] = current;
			}
		}

		private static void insertionSort(double[] a, int leftIndex, int rightIndex) {
			for (int i = leftIndex + 1; i <= rightIndex; i++) {
				double current = a[i];
				int j = i - 1;
				while (j >= leftIndex && a[j] > current) {
					a[j + 1] = a[j];
					j--;
				}
				a[j + 1] = current;
			}
		}

	}

	void debug(Object... o) {
		if (LOCAL) {
			System.err.println(Arrays.deepToString(o));
		}
	}

//------------------------------------------------------------------------------

	void solve() throws IOException {
		int n = readInt();
		int m = readInt();
		int k = readInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = readInt();
		}
		Mergesort.sort(a);
		for (int need = 0; need <= n; need++) {
			int cnt = k;
			for (int i = 0; i < need; i++) {
				cnt += a[n - i - 1] - 1;
			}
			if (cnt >= m) {
				out.println(need);
				return;
			}
		}
		out.println(-1);
	}

}


import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class A
{
	String line;
	StringTokenizer inputParser;
	BufferedReader is;
	FileInputStream fstream;
	DataInputStream in;
	String FInput="";

	void openInput(String file)
	{

		if(file==null)is = new BufferedReader(new InputStreamReader(System.in));//stdin
		else
		{
			try{

			fstream = new FileInputStream(file);
			in = new DataInputStream(fstream);
			is = new BufferedReader(new InputStreamReader(in));
			}catch(Exception e)
			{
				System.err.println(e);
			}
		}

	}

	void readNextLine()
	{
		try {
			line = is.readLine();
			inputParser = new StringTokenizer(line, " ");
			//System.err.println("Input: " + line);
		} catch (IOException e) {
			System.err.println("Unexpected IO ERROR: " + e);
		}
		catch (NullPointerException e)
		{
			line=null;

		}

	}

	int NextInt()
	{
		String n = inputParser.nextToken();
		int val = Integer.parseInt(n);

		//System.out.println("I read this number: " + val);
		return val;
	}

	long NextLong()
	{
		String n = inputParser.nextToken();
		long val = Long.parseLong(n);

		//System.out.println("I read this number: " + val);
		return val;
	}

	String NextString()
	{
		String n = inputParser.nextToken();
		return n;
	}

	void closeInput()
	{
		try {
			is.close();
		} catch (IOException e) {
			System.err.println("Unexpected IO ERROR: " + e);
		}

	}

	public static void main(String [] argv)
	{
		//String filePath="input.txt";
		//String filePath="D:\\_d\\learn\\coursera\\algorithms and design II\\data\\knapsack2.txt";
        String filePath=null;
		if(argv.length>0)filePath=argv[0];
		new A(filePath);
	}

	public void readFInput()
	{
		for(;;)
		{
			try
			{
				readNextLine();
				FInput+=line+" ";
			}
			catch(Exception e)
			{
				break;
			}
		}
		inputParser = new StringTokenizer(FInput, " ");
	}

	public A(String inputFile)
	{
		openInput(inputFile);
		readNextLine();
		int N=NextInt(), M=NextInt(), K=NextInt();
		int [] v = new int[N];
		readNextLine();
		for(int i=0; i<N; i++)
		{

			v[i]=NextInt();

		}
		Arrays.sort(v);
		M-=(K-1);
		int id=N-1;
		int ret=0;
		while(M>1&&id>=0)
		{
			M++;
			M-=v[id--];
			ret++;
		}
		if(id<0&&M>1)ret=-1;
		System.out.println(ret);
		closeInput();
	}

	public static void out(Object s)
	{
		try
		{
		    FileWriter fstream = new FileWriter("output.txt");
			BufferedWriter out = new BufferedWriter(fstream);
			out.write(s.toString());
			out.close();
		}catch (Exception e){
			System.err.println("Error: " + e.getMessage());
		}
	}

}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class A {

    static StringTokenizer st;
    static BufferedReader in;
    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        int n = nextInt();
        int m = nextInt();
        int k = nextInt();
        int[]a = new int[n+1];
        for (int i = 1; i <= n; i++) {
            a[i] = nextInt();
        }
        if (k >= m) {
            System.out.println(0);
            return;
        }
        Arrays.sort(a, 1, n+1);
        int ans = 0;
        for (int i = n; i >= 1; i--) {
            ans++;
            k--;
            k += a[i];
            if (k >= m) {
                System.out.println(ans);
                return;
            }
        }
        System.out.println(-1);
        pw.close();
    }
    private static int nextInt() throws IOException{
        return Integer.parseInt(next());
    }

    private static long nextLong() throws IOException{
        return Long.parseLong(next());
    }

    private static double nextDouble() throws IOException{
        return Double.parseDouble(next());
    }

    private static String next() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }
}


import java.util.*;
import java.io.*;

public class Sockets {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer st;

    String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(in.readLine());
        return st.nextToken();
    }

    int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    void solve() throws Exception {
        int n = nextInt();
        int m = nextInt();
        int k = nextInt();
        List<Integer> fs = new ArrayList<Integer>();
        for (int i = 0; i < n; i++)
            fs.add(nextInt());
        Collections.sort(fs);
        Collections.reverse(fs);
        int c = k;
        for (int i = 0; i < fs.size(); i++) {
            if (c >= m) {
                out.println(i);
                return;
            }
            c += (fs.get(i)-1);
        }
        if (c>=m)
            out.println(fs.size());
        else
            out.println(-1);
    }

    void run() {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
//            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter(System.out);
            solve();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        } finally {
            out.close();
        }
    }

    public static void main(String[] args) {
        new Sockets().run();
    }

}


import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author c0der
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskA {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        int m = in.nextInt();
        int k = in.nextInt();
        int[] a = new int[ n ];
        for (int i=0; i<n; i++) a[i] = in.nextInt();

        if ( m <= k ) out.println( 0 );
        else
        {
            m -= k - 1;
            Arrays.sort( a );
            int ans = 0;
            for (int i=n-1; i>=0; i--)
            {
                ans++;
                //out.println(m+" "+a[i]);
                m -= a[ i ];
                if ( m <= 0 ) break;
                m++;
            }
            if ( m > 0 ) out.println( -1 );
            else out.println( ans );
        }
    }
}

class InputReader {
    BufferedReader br;
    StringTokenizer st;

    public InputReader(InputStream in)
    {
        br = new BufferedReader(new InputStreamReader(in));
        st = null;
    }

    public String next()
    {
        while (st==null || !st.hasMoreTokens())
        {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return st.nextToken();
    }

    public int nextInt()
    {
        return Integer.parseInt(next());
    }
}


import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.*;

/**
 * Generated by Contest helper plug-in
 * Actual solution is at the bottom
 */
public class Main {
    public static void main(String[] args) {
        InputReader in = new StreamInputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        run(in, out);
    }

    public static void run(InputReader in, PrintWriter out) {
        Solver solver = new TaskB();
        solver.solve(1, in, out);
        Exit.exit(in, out);
    }
}

abstract class InputReader {
    private boolean finished = false;

    public abstract int read();

    public int readInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public String readString() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuffer res = new StringBuffer();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    private boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public void setFinished(boolean finished) {
        this.finished = finished;
    }

    public abstract void close();
}

class StreamInputReader extends InputReader {
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar, numChars;

    public StreamInputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public void close() {
        try {
            stream.close();
        } catch (IOException ignored) {
        }
    }
}

class Exit {
    private Exit() {
    }

    public static void exit(InputReader in, PrintWriter out) {
        in.setFinished(true);
        in.close();
        out.close();
    }
}

interface Solver {
    public void solve(int testNumber, InputReader in, PrintWriter out);
}

class TaskB implements Solver
{
    public void solve(int testNumber, InputReader in, PrintWriter out)
    {
        int n = in.readInt();
        int m = in.readInt();
        int k = in.readInt();
        int[] a = new int[n];
        for(int i=0;i<n;i++) a[i] = in.readInt();
        Arrays.sort(a);
        if(k>=m)
        {
            out.println(0);
        }
        else
        {
            for(int i=n-1;i>=0;i--)
            {
                k += (a[i]-1);
                if(k>=m)
                {
                    out.println(n-i);
                    return;
                }
            }
            if(k<m) out.println(-1);
        }
    }
}


import java.io.*;
import java.util.*;

public class A {

	BufferedReader in;
	StringTokenizer st;
	PrintWriter out;

	String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

	int nextInt() throws Exception {
		return Integer.parseInt(next());
	}

	long nextLong() throws Exception {
		return Long.parseLong(next());
	}

	double nextDouble() throws Exception {
		return Double.parseDouble(next());
	}

	void solve() throws Exception {
		int n = nextInt(), k = nextInt(), s = nextInt();
		int a[] = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = -nextInt();

		Arrays.sort(a);
		for(int i=0;i<n;i++)
		{
			if (s>=k)
			{
				out.println(i);
				return;
			}

			s += -a[i];
			s--;
		}
		if (s<k)
			out.println(-1);
		else
			out.println(n);
	}

	void run() {
		try {
			Locale.setDefault(Locale.US);
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(new OutputStreamWriter(System.out));
			solve();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	public static void main(String[] args) {
		new A().run();
	}

}


//package Round_159;

import java.util.*;
import java.io.*;

import static java.lang.Math.*;

public class a {

	void solve() throws Exception {
		int n = in.nextInt();
		int m = in.nextInt();
		int k = in.nextInt();
		int a[] = new int[n];
		for (int i = 0; i<n; i++){
			a[i] = in.nextInt();
		}
		Arrays.sort(a);
		int sum = 0;
		if (k >= m){
			out.println(0);
			return;
		}
		sum = a[n-1] + k - 1;
		int j = 1;
		for (int i = n-2; i >=0 && sum < m; i--, j++){
			sum += a[i] - 1;
		}
		if (sum < m){
			out.println(-1);
		}else{
			out.println(j);
		}
	}

	FastScanner in;
	PrintWriter out;

	String input = "";
	String output = "";

	void run() {
		try {
			if (input.length() > 0) {
				in = new FastScanner(new BufferedReader(new FileReader(input)));
			} else
				in = new FastScanner(new BufferedReader(new InputStreamReader(
						System.in)));
			if (output.length() > 0)
				out = new PrintWriter(new FileWriter(output));
			else
				out = new PrintWriter(System.out);

			solve();

			out.flush();
			out.close();
		} catch (Exception ex) {
			ex.printStackTrace();
			out.flush();
			out.close();
		} finally {
			out.close();
		}
	}

	public static void main(String[] args) {
		new a().run();
	}

	class FastScanner {
		BufferedReader bf;
		StringTokenizer st;

		public FastScanner(BufferedReader bf) {
			this.bf = bf;
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(bf.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public String nextLine() throws IOException {
			return bf.readLine();
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

	}

}


import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.PrintStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author coderbd
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
        int m, n, k;
        n = in.readInt();
        m = in.readInt();
        k = in.readInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = in.readInt() - 1;
        Arrays.sort(a);
        int ans = -1;
        if (k >= m)
            ans = 0;
        else for (int i = 0; i < n; i++) {
            k += a[n-i-1];
            if (k >= m) {
                ans = i + 1;
                break;
            }
        }
        System.out.println(ans);
    }
}

class InputReader {
    private boolean finished = false;

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            }
            catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public int peek() {
        if (numChars == -1)
            return -1;
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            }
            catch (IOException e) {
                return -1;
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar];
    }

    public int readInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public long readLong() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0L;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public String readString() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuffer res = new StringBuffer();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    public static boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    private String readLine0() {
        StringBuffer buf = new StringBuffer();
        int c = read();
        while (c != '\n' && c != -1) {
            if (c != '\r')
                buf.appendCodePoint(c);
            c = read();
        }
        return buf.toString();
    }

    public String readLine() {
        String s = readLine0();
        while (s.trim().length() == 0)
            s = readLine0();
        return s;
    }

    public String readLine(boolean ignoreEmptyLines) {
        if (ignoreEmptyLines)
            return readLine();
        else
            return readLine0();
    }

    public BigInteger readBigInteger() {
        try {
            return new BigInteger(readString());
        }
        catch (NumberFormatException e) {
            throw new InputMismatchException();
        }
    }

    public char readCharacter() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        return (char) c;
    }

    public double readDouble() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        double res = 0;
        while (!isSpaceChar(c) && c != '.') {
            if (c == 'e' || c == 'E')
                return res * Math.pow(10, readInt());
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        }
        if (c == '.') {
            c = read();
            double m = 1;
            while (!isSpaceChar(c)) {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, readInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                m *= 10;
                res += (c - '0') * m;
                c = read();
            }
        }
        return res * sgn;
    }

    public boolean isExhausted() {
        int value;
        while (isSpaceChar(value = peek()) && value != -1)
            read();
        return value == -1;
    }

    public String next() {
        return readString();
    }
}

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object...objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }

    public void printLine(Object...objects) {
        print(objects);
        writer.println();
    }

    public void printLine(char[] array) {
        writer.print(array);
    }

    public void printFormat(String format, Object...objects) {
        writer.printf(format, objects);
    }

    public void close() {
        writer.close();
    }

    public void flush() {
        writer.flush();
    }
}


import java.awt.Point;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;

import static java.lang.Math.*;

public class Start {

    final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    void init() throws FileNotFoundException {
        if (ONLINE_JUDGE) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        } else {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        }
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    public static void main(String[] args) {
        new Start().run();
        // Sworn to fight and die
    }

    public static void mergeSort(int[] a) {
        mergeSort(a, 0, a.length - 1);
    }

    private static void mergeSort(int[] a, int levtIndex, int rightIndex) {
        final int MAGIC_VALUE = 50;
        if (levtIndex < rightIndex) {
            if (rightIndex - levtIndex <= MAGIC_VALUE) {
                insertionSort(a, levtIndex, rightIndex);
            } else {
                int middleIndex = (levtIndex + rightIndex) / 2;
                mergeSort(a, levtIndex, middleIndex);
                mergeSort(a, middleIndex + 1, rightIndex);
                merge(a, levtIndex, middleIndex, rightIndex);
            }
        }
    }

    private static void merge(int[] a, int levtIndex, int middleIndex,
            int rightIndex) {
        int length1 = middleIndex - levtIndex + 1;
        int length2 = rightIndex - middleIndex;
        int[] levtArray = new int[length1];
        int[] rightArray = new int[length2];
        System.arraycopy(a, levtIndex, levtArray, 0, length1);
        System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);
        for (int k = levtIndex, i = 0, j = 0; k <= rightIndex; k++) {
            if (i == length1) {
                a[k] = rightArray[j++];
            } else if (j == length2) {
                a[k] = levtArray[i++];
            } else {
                a[k] = levtArray[i] <= rightArray[j] ? levtArray[i++]
                        : rightArray[j++];
            }
        }
    }

    private static void insertionSort(int[] a, int levtIndex, int rightIndex) {
        for (int i = levtIndex + 1; i <= rightIndex; i++) {
            int current = a[i];
            int j = i - 1;
            while (j >= levtIndex && a[j] > current) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = current;
        }
    }

    public void run() {
        try {
            long t1 = System.currentTimeMillis();
            init();
            solve();
            out.close();
            long t2 = System.currentTimeMillis();
            System.err.println("Time = " + (t2 - t1));
        } catch (Exception e) {
            e.printStackTrace(System.err);
            System.exit(-1);
        }
    }

    class LOL implements Comparable<LOL> {
        int x;
        int y;
        int num;

        public LOL(int x, int y,int num) {
            this.x = x;
            this.y = y;
            this.num = num;
        }

        @Override
        public int compareTo(LOL o) {
            return x - o.x; // ---->
            // return o.x - x; // <----
            // return o.y-y;
        }

    }

    public void solve() throws IOException {

        int n = readInt();
        int m = readInt();
        int k = readInt();

        int [] a = new int [n];
        for (int i = 0; i < n; i++){
            a[i] = readInt();
        }
        mergeSort(a);

        if (k>=m){
            out.print(0);
             return;
        }

        int ans = 0;
        k--;
        for (int i = n-1; i >=0; i--){
            ans += a[i];
            if (ans +  k >= m){
                out.print(n-i);
                return;
            }
            else {
                k--;
            }

        }
        out.print(-1);

    }

}


import java.util.*;
import java.io.*;

public class Main {

    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int n = in.nextInt(), m = in.nextInt(), k = in.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = in.nextInt();
        Arrays.sort(a);
        int ans = 0, r = k, p = n-1;
        while (r < m && p >= 0) {
            r = r - 1 + a[p];
            p--;
            ans++;
        }
        if (r < m) out.println("-1");
        else out.println(ans);

        out.flush();
    }

}


import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);

        int n = s.nextInt();
        int m = s.nextInt();
        int k = s.nextInt();

        int a[] = new int [n];
        for (int i = 0; i < a.length; i++) {
            a[i] = s.nextInt();
        }
        int ans = 0;

        while(k < m){
            k--;
            int max = -1;
            int ix = -1;
            for (int i = 0; i < a.length; i++) {
                if(a[i] > max){
                    max = a[i];
                    ix = i;
                }
            }
            if(ix == -1){
                System.out.println("-1");
                return ;
            }
            k += a[ix];
            a[ix] = -1;
            ans++;
        }
        System.out.println(ans);
    }

}


//package round159;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class A {
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	void solve()
	{
		int n = ni(), m = ni(), K = ni();
		int[] a = na(n);
		a = radixSort(a);

		if(K >= m){
			out.println(0);
			return;
		}
		int p = 1;
		for(int i = n-1;i >= 0;i--){
			K += a[i]-1;
			if(K >= m){
				out.println(p);
				return;
			}
			p++;
		}
		out.println(-1);
	}

	public static int[] radixSort(int[] f)
	{
		int[] to = new int[f.length];
		{
			int[] b = new int[65537];
			for(int i = 0;i < f.length;i++)b[1+(f[i]&0xffff)]++;
			for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
			for(int i = 0;i < f.length;i++)to[b[f[i]&0xffff]++] = f[i];
			int[] d = f; f = to;to = d;
		}
		{
			int[] b = new int[65537];
			for(int i = 0;i < f.length;i++)b[1+(f[i]>>>16)]++;
			for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
			for(int i = 0;i < f.length;i++)to[b[f[i]>>>16]++] = f[i];
			int[] d = f; f = to;to = d;
		}
		return f;
	}

	void run() throws Exception
	{
		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}

	public static void main(String[] args) throws Exception { new A().run(); }

	private byte[] inbuf = new byte[1024];
	private int lenbuf = 0, ptrbuf = 0;

	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }

	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}

	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}

	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}


//package A;

import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class Solution {
    public static void main(String args[]) throws IOException {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();
        int k = in.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; ++i)
            a[i] = in.nextInt();
        Arrays.sort(a);

        int res = 0, p = n - 1;
        while (k < m && p >= 0) {
            ++res;
            k += a[p] - 1;
            --p;
        }
        if (k >= m)
            System.out.println(res);
        else
            System.out.println("-1");
    }
}


import java.util.Arrays;
import java.util.Scanner;

public class Main2 {

    public static void main(String args[]){
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int m = input.nextInt();
        int k = input.nextInt();
        int[] num = new int[n];
        for(int i = 0 ; i < n ; i++){
        	num[i] = input.nextInt();
        }

        System.out.println(str(n,m,k,num));
    }

	static int str(int n,int m,int k,int[] num){
		Arrays.sort(num);
		int total = k;
		int count = 0;
		while(k < m){
			if(count == num.length)return -1;
			k += num[num.length-count-1]-1;
			count++;
		}
		return count;
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] in = br.readLine().split(" ");

		int n=Integer.parseInt(in[0]),m=Integer.parseInt(in[1]),k=Integer.parseInt(in[2]);

		StringTokenizer st = new StringTokenizer(br.readLine());
		int[] caps = new int[n];
		for (int i = 0; i < caps.length; i++) {
			caps[i] = Integer.parseInt(st.nextToken());
		}
		Arrays.sort(caps);

		int curSockets=k, neededLines=0;
		int i = n-1;
		while(curSockets<m && i>=0){
			curSockets+=caps[i]-1;
			neededLines++;
			i--;
		}
		if(curSockets>=m)
			System.out.println(neededLines);
		else
			System.out.println(-1);
	}
}


import java.io.*;
import java.util.*;
import java.lang.*;

public class Main {

  public static void main(String[] args) {
    Scanner cin=new Scanner(new BufferedInputStream(System.in));

    int n=cin.nextInt(),
        m=cin.nextInt(),
        k=cin.nextInt();
    int[] a=new int[51];

    for (int i=0;i<n;i++) {
      a[i]=-cin.nextInt();
    }
    Arrays.sort(a);

    if (m<=k) {
        System.out.println(0);
        return;
    }
    for (int i=0;i<Math.min(k,n);i++) {
      m+=a[i];
      if (m-(k-1-i)<=0) {
        System.out.println(i+1);
        return;
      }
    }
    for (int i=k;i<n;i++) {
      m+=a[i]+1;
      if (m<=0) {
        System.out.println(i+1);
        return;
      }
    }
    System.out.println(-1);

    cin.close();
  }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class CFTest6 {

	static BufferedReader br;

	public static void main(String[] args) {
		br = new BufferedReader(new InputStreamReader(System.in));

		try {

			int[] a1 = readIntArr();
			int[] a2 = readIntArr();
			br.close();
			int f = a1[0];
			int d = a1[1];
			int s = a1[2];
			Arrays.sort(a2);

			if (d <= s)
				System.out.println(0);

			else {
				int cur = d - s + 1;

				int num=0;
				for(int i=0;i<f;i++){
					num++;
					cur-=a2[f-i-1];
					if(cur<=0)break;
					cur++;
				}
				if (cur > 0)
					System.out.println(-1);
				else{

					System.out.println(num);
				}
			}

		} catch (IOException e) {
			e.printStackTrace();
		}

	}

	static public String readLine() throws IOException {
		return br.readLine();

	}

	static public String readString() throws IOException {
		return br.readLine();

	}

	static public long readlong() throws IOException {
		return Long.parseLong(br.readLine());
	}

	static public int readInt() throws IOException {
		return Integer.parseInt(br.readLine());
	}

	static public int[] readIntArr() throws IOException {
		String[] str = br.readLine().split(" ");
		int arr[] = new int[str.length];
		for (int i = 0; i < arr.length; i++)
			arr[i] = Integer.parseInt(str[i]);
		return arr;
	}

	static public double[] readDoubleArr() throws IOException {
		String[] str = br.readLine().split(" ");
		double arr[] = new double[str.length];
		for (int i = 0; i < arr.length; i++)
			arr[i] = Double.parseDouble(str[i]);
		return arr;
	}

	static public long[] readLongArr() throws IOException {
		String[] str = br.readLine().split(" ");
		long arr[] = new long[str.length];
		for (int i = 0; i < arr.length; i++)
			arr[i] = Long.parseLong(str[i]);
		return arr;
	}

	static public double readDouble() throws IOException {
		return Double.parseDouble(br.readLine());
	}
}


import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.util.Comparator;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.Collections;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n=in.nextInt();
        int m=in.nextInt();
        int k=in.nextInt();
        Integer []cap=new Integer[n];
        for(int i=0;i<n;i++) {
            cap[i]=in.nextInt();
        }
        Arrays.sort(cap, Collections.reverseOrder());
        int count=0;

        while(k<m && count<cap.length) {
            k+=(cap[count]-1);
            ++count;
        }
        if(k>=m) {
            out.println(count);
        } else {
            out.println(-1);
        }
    }
}

class InputReader {
    StringTokenizer st;
    BufferedReader in;
    public InputReader(InputStream ins)
    {
        in = new BufferedReader(new InputStreamReader(ins));
    }

    public String nextToken()
    {
        while(st==null || !st.hasMoreTokens())
        {
            try {
                st=new StringTokenizer(in.readLine());
            } catch (IOException e) {
                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
            }
        }
        return st.nextToken();
    }
    public int nextInt()
    {

        return Integer.parseInt(nextToken());
    }

    }