import java.util.Scanner;

public class Problems {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int B = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = sc.nextInt();
        }

        int[] buckets = new int[101];
        int sum = 0;

        int evens = 0;
        int odds = 0;
        int start = 0;
        int count = 0;
        int k = 1;

        for (int i = 0; i < arr.length - 1; i++) {
            if (arr[i] % 2 == 0) {
                evens++;
            } else {
                odds++;
            }

            if (evens == odds) {
                int diff = Math.abs(arr[i + 1] - arr[i]);
                int max = bucketMax(buckets);
                if (sum > B && diff < max) {
                    sum -= max;
                    buckets[max]--;
                    buckets[diff]++;
                    sum += diff;
                } else if (sum < B){
                    sum += diff;
                    buckets[diff]++;
                    count++;
                    start = i + 1;
                }
                if (i == arr.length - 2 && k < arr.length - 1) {
                    i = start++;
                    evens = odds = 0;
                }
            }

        }
        int i = buckets.length - 1;
        while (sum > B) {
            if (buckets[i] > 0) {
                sum -= i;
                count--;
            } else {
                i--;
            }
        }

        System.out.println(count);
    }

    private static int bucketMax(int[] buckets) {
        for (int i = buckets.length - 1; i >= 0; i--) {
            if (buckets[i] > 0) {
                return i;
            }
        }
        return -1;
    }
}


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

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class Main {
    FastScanner in;
    PrintWriter out;
    int p = 1000000009;

    private void solve() throws IOException {
        int n = in.nextInt(), b = in.nextInt();
        int[] odd = new int[n];
        int[] a = new int[n];
        int[] price = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }
        if (a[0] % 2 == 1)
            odd[0] = 1;
        else odd[0]--;
        for (int i = 1; i < n; i++) {
            if (a[i] % 2 == 1)
                odd[i] = odd[i - 1] + 1;
            else odd[i] = odd[i - 1] - 1;
        }
        for (int i = 0; i < n - 1; i++) {
            price[i] = abs(a[i + 1] - a[i]);
        }
        ArrayList<Integer> prices = new ArrayList<>();
        for (int i = 1; i < n - 1; i++) {
            if (odd[i] == 0) {
                prices.add(price[i]);
            }
        }
        sort(prices);
        int ans = 0;
        for (int i : prices
        ) {
            if (b - i >= 0) {
                b -= i;
                ans++;
            } else break;
        }
        out.println(ans);
    }

    class FastScanner {
        StringTokenizer st;
        BufferedReader br;

        FastScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

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

        boolean hasNext() throws IOException {
            return br.ready() || (st != null && st.hasMoreTokens());
        }

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

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

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

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

        boolean hasNextLine() throws IOException {
            return br.ready();
        }
    }

    private void run() throws IOException {
        in = new FastScanner(System.in);

        out = new PrintWriter(System.out);

        solve();
        out.flush();
        out.close();
    }

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


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

public class Solution {
    static int max;
    public static void main (String[] args) throws java.lang.Exception
	{
        FastReader fr = new FastReader();
        int n = fr.nextInt();
        int k = fr.nextInt();
        int arr[] = new int[n];
        for(int i=0;i<n;i++){
            arr[i] = fr.nextInt();
        }
        int even = 0, odd = 0;
        ArrayList<Integer> al = new ArrayList<>();
        for(int i=0;i<n;i++){
            if(i!=0){
                if(even == odd){
                    al.add(Math.abs(arr[i]-arr[i-1]));
                }
            }
            if(arr[i]%2 == 0){
                even++;
            }
            else{
                odd++;
            }
        }
        Collections.sort(al);
        int count = 0;
        for(int i=0;i<al.size();i++){
            int element = al.get(i);
            if(element<=k){
                count++;
                k-=element;
            }
            else{
                break;
            }
        }
        System.out.println(count);
    }

    static int gcd(int a, int b) {
      if (b == 0)
        return a;
      return gcd(b, a % b);
    }

    static int lcm(int a, int b){
        int g = gcd(a,b);
        return a*(b/g);
    }

    static int exponentMod(int A,  int B, int C)  {
        if (A == 0)
            return 0;
        if (B == 0)
            return 1;
        long y;
        if (B % 2 == 0)
        {
            y = exponentMod(A, B / 2, C);
            y = (y * y) % C;
        }
        else
        {
            y = A % C;
            y = (y * exponentMod(A, B - 1,  C) % C) % C;
        }
        return (int)((y + C) % C);
    }

    static class FastReader{
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

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

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

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

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

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


import java.util.*;

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

		int n = input.nextInt();
		int b = input.nextInt();

		int[] a = new int[n + 1];
		int[] even = new int[n + 1];
		int[] odd = new int[n + 1];

		for (int i = 1; i <= n; i++) {
			a[i] = input.nextInt();
			if (a[i] % 2 == 0) {
				even[i] = even[i - 1] + 1;
				odd[i] = odd[i - 1];
			} else {
				odd[i] = odd[i - 1] + 1;
				even[i] = even[i - 1];
			}
		}

		input.close();

		List<Integer> l = new ArrayList<>();
		for (int j = 2; j < n; j++) {
			int diff = Math.abs(a[j] - a[j + 1]);
			if (even[j] == odd[j]) {
				l.add(diff);
			}
		}

		Collections.sort(l);

		int count = 0;
		for (int i = 0; i < l.size(); i++) {
			if (b >= l.get(i)) {
				b -= l.get(i);
				count++;
			}
		}

		System.out.println(count);
	}
}


import java.util.*;

public class Cutting{

     public static void main(String []args){
        Scanner s = new Scanner(System.in);
        String input = s.nextLine();
        int n = Integer.parseInt(input.split(" ")[0]);
        int bitCoins = Integer.parseInt(input.split(" ")[1]);
        String[] values = s.nextLine().split(" ");
        int odd = 0;
        int even = 0;
        int count = 0;
        ArrayList<Integer> val = new ArrayList<Integer>();
        for (int i = 0; i < n - 1; i++ ) {
            if(Integer.parseInt(values[i]) % 2 == 0) {
                even++;
            } else {
                odd++;
            }
            if(odd == even) {
               int diff =  Integer.parseInt(values[i + 1]) - Integer.parseInt(values[i]);
               if (diff < 0) {
                   diff = diff * -1;
               }
               val.add(diff);
            }
        }
        Collections.sort(val);
        for (int j = 0; j < val.size(); j++ ) {
            if (val.get(j) <= bitCoins) {
                bitCoins = bitCoins - val.get(j);
                count++;
            } else {
                break;
            }
        }
        System.out.println(count);
     }
}


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

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);
        Unstoppable solver = new Unstoppable();
	//	int t=in.nextInt();
	//	while(t-->0)
        solver.solve(in, out);
        out.close();
    }

    static class Unstoppable {

        public void solve(InputReader in, PrintWriter out) {
         int n=in.nextInt();
         long b=in.nextLong();
         int a[]=new int[n];
         int c[]=new int[n];
         for(int i=0;i<n;i++) {
            a[i]=in.nextInt();
            if(a[i]%2==0) c[i]=1;
            else c[i]=-1;
         }
         long sum=0;
         ArrayList<Integer> array=new ArrayList<>();
         for(int i=0;i<n-1;i++)
         {
             sum+=c[i];
             if(sum==0){ array.add(Math.abs(a[i]-a[i+1])); }
         }
         sum=0;
         int count=0;
         Collections.sort(array);
         for(int i=0;i<array.size();i++)
         {
             sum+=array.get(i);
             if(sum<=b) count++; else break;
         }
         out.println(count);
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
        public long nextLong(){
            return Long.parseLong(next());
        }
        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}


import java.io.*;
import java.math.BigInteger;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

public class MMain {

    static final int INF = Integer.MAX_VALUE;

    static void mergeSort(long[] a, int[] b, int p, int r) {
        if (p < r) {
            int q = (p + r) >>1;
            mergeSort(a, b, p, q);
            mergeSort(a, b, q + 1, r);
            merge(a, b, p, q, r);
        }
    }

    static void merge(long[] a, int[] b, int p, int q, int r) {
        int n1 = q - p + 1;
        int n2 = r - q;
        long[] L = new long[n1 + 1], R = new long[n2 + 1];
        int[] L1 = new int[n1 + 1], R1 = new int[n2 + 1];

        for (int i = 0; i < n1; i++) {
            L[i] = a[p + i];
            L1[i] = b[p + i];

        }
        for (int i = 0; i < n2; i++) {
            R[i] = a[q + 1 + i];
            R1[i] = b[q + 1 + i];

        }
        L[n1] = R[n2] = INF;
        L1[n1] = R1[n2] = INF;

        for (int k = p, i = 0, j = 0; k <= r; k++) {
            if (L[i] <= R[j]) {

                a[k] = L[i];
                b[k] = L1[i++];

            } else {
                a[k] = R[j];
                b[k] = R1[j++];

            }
        }
    }

    static void mergeSort(int[] a, int[] b, int[] c, int p, int r) {
        if (p < r) {
            int q = (p + r) >>1;
            mergeSort(a, b, c, p, q);
            mergeSort(a, b, c, q + 1, r);
            merge(a, b, c, p, q, r);
        }
    }

    static void merge(int[] a, int[] b, int[] c, int p, int q, int r) {
        int n1 = q - p + 1;
        int n2 = r - q;
        int[] L = new int[n1 + 1], R = new int[n2 + 1];
        int[] L1 = new int[n1 + 1], R1 = new int[n2 + 1];
        int[] L2 = new int[n1 + 1], R2 = new int[n2 + 1];
        // int[] L2 = new int[n1 + 1], R2 = new int[n2 + 1];

        for (int i = 0; i < n1; i++) {
            L[i] = a[p + i];
            L1[i] = b[p + i];
            L2[i] = c[p + i];
            // L2[i] = a[p + i];
        }
        for (int i = 0; i < n2; i++) {
            R[i] = a[q + 1 + i];
            R1[i] = b[q + 1 + i];
            R2[i] = c[q + 1 + i];
            //  R2[i] = a[q + 1 + i];
        }
        L[n1] = R[n2] = INF;
        L1[n1] = R1[n2] = INF;
        L2[n1] = R2[n2] = INF;
        int j = 0, k = 0;
        for (int i = p; i <= r; i++) {
            if (L[j] < R[k]) {
                a[i] = L[j];
                b[i] = L1[j];
                c[i] = L2[j++];
                //j++;
            } else if ((L[j] > R[k])) {
                a[i] = R[k];
                b[i] = R1[k];
                c[i] = R2[k++];
                //k++;
            } else {
                //des
                if (L1[j] > R1[k]) {
                    a[i] = L[j];
                    b[i] = L1[j];
                    c[i] = L2[j++];
                    //j++;
                } else {
                    a[i] = R[k];
                    b[i] = R1[k];
                    c[i] = R2[k++];
                }
            }

        }
    }

    public static int[] sieve(int n) {
        int a[] = new int[n + 1];
        for (int i = 2; i <= n; i++) {
            a[i] = 1;
        }
        for (int i = 2; i <= Math.sqrt(n); i++) {
            if (a[i] == 1) {
                for (int k = 2; i * k <= n; k++) {
                    a[i * k] = 0;
                }
            }
        }
        return a;
    }

    public static long sum(int a) {
        long su = 0;
        while (a > 0) {
            su += (long) a % 10;
            a /= 10;
        }
        return su;
    }

    public static boolean prime(int n) {
        if (n == 1) {
            return true;
        }

        for (int i = 2; i <= Math.sqrt(n); i++) {
            if (n % i == 0) {
                return false;
            }
        }
        return true;
    }

    public static boolean isvowel(char c) {
        if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' || c == 'y') {
            return true;
        } else {
            return false;
        }
    }

    static long gcd(long a, long b) {
        return b == 0 ? a : gcd(b, a % b);
    }

    static List<Integer> gd(int a, int b) {
        int m = (int) gcd(a, b);
        List<Integer> q = new ArrayList();
        for (int i = 1; i * i <= m; ++i) {
            if (m % i == 0) {
                q.add(i);
                if (i != m / i) {
                    q.add(m / i);
                }
            }
        }
        return q;
    }

    static long sum(long n) {
        return n * (n + 1) / 2;
    }

    static int divisors(int n, int m) {
        if (n - (m + (m * m)) >= 0) {
            return m;
        }
        for (int i = (int) Math.sqrt(m); i >= 1; i--) {
            if (m % i == 0 && n - (m + (m * i)) >= 0) {
                return i;
            }
        }
        return 1;
    }

    static boolean cal(int val, int k, int t) {
        int res = val, p = 1;
        while (val / Math.pow(k, p) > 0) {
            res += val / Math.pow(k, p);
            p++;
        }
        return res >= t;
    }

    static int Last_Ocuu(int[] a, int n, long v) {
        int start = 0, end = n - 1, mid, ans = -1;

        while (start <= end) {
            mid = (start + end) >> 1;
            if (a[mid] >= v) {
                ans = mid;
                end = mid - 1;
            } else if (a[mid] < v) {
                //ans=mid;
                start = mid + 1;
            }

        }
        return ans;
    }

    static boolean Last_Ocuu(long[] a, int n, long v) {
        int sta = 1, end = n - 1;
        while (sta <= end) {
            int mid = (sta + end) >> 1;
            if (a[mid] == v) {
                return true;
            } else if (a[mid] > v) {
                end = mid - 1;
            } else {
                sta = mid + 1;
            }
        }
        return false;
    }

    static void print(int a, String s) {

        if (a > 0) {
            //s+='*';
            System.out.println(s);
            print(a - 1, '*' + s);
        } else {
            return;
        }
    }

    static long summtion(int[] a) {
        long s = 0;
        for (int i = 0; i < a.length; i++) {
            s += (long) a[i];
        }
        return s;
    }

    public static void main(String[] args) throws IOException, ParseException {
        Scannerr in = new Scannerr(System.in);
        PrintWriter or = new PrintWriter(System.out);
     int n = in.nextInt(),B=in.nextInt();
     int[] a= new int[n];
     ArrayList<Integer> sol= new ArrayList();
     int even=0,odd=0;
        for (int i = 0; i < n; i++)    a[i]=in.nextInt();
           for (int i = 0; i < n-1; i++) {
             if((a[i]&1)==0)    ++even;
            else ++odd;
            if (even==odd) {
                  sol.add(Math.abs(a[i]-a[i+1]));
            }
        }

        Collections.sort(sol);
        int ans=0;
        for (int i = 0; i < sol.size(); i++) {
            if(sol.get(i)<=B){
                    ++ans;
                    B-=sol.get(i);
            }
            else break;
        }
        or.print(ans);

        or.flush();
    }

    static class Scannerr {

        StringTokenizer st;
        BufferedReader br;

        public Scannerr(FileReader fileReader) throws FileNotFoundException {
            br = new BufferedReader(fileReader);
        }

        public Scannerr(InputStream s) throws FileNotFoundException {
            br = new BufferedReader(new InputStreamReader(s));
        }

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

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++) {
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec) {
                        f *= 10;
                    }
                }
            }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

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

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

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

        public boolean ready() throws IOException {
            return br.ready();
        }

    }

}

class Pair {

    int value;
    int index;

    // int min;
    public Pair(int value, int index) {
        this.value = value;
       this. index = index;
        //min = m;
    }

}


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

public class ar {

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (final IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (final IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    // static boolean[] seen;
    static Map<Integer, Integer> map;
    // static Map<Long, Long> lmap;
    // static Set<Character> charset;
    // static Set<Integer> set;
    static int[] arr;
    static int[][] dp;
    // static int rem = (int) 1e9 + 7;
    // static List<List<Integer>> graph;
    // static int[][] kmv = { { 2, 1 }, { 1, 2 }, { 2, -1 }, { -1, 2 }, { -2, 1 }, { 1, -2 }, { -1, -2 }, { -2, -1 } };
    // static char[] car;
    // static boolean[] primes;
    // static int MAX = (int) 1e4 + 1;
    // static double[] dar;
    // static long[] lar;
    // static long[][] dlar;

    // static void Sieve() {
    //     primes = new boolean[MAX];
    //     primes[0] = true;
    //     primes[1] = true;
    //     for (int i = 2; i * i < MAX; i++) {
    //         if (!primes[i]) {
    //             for (int j = i * i; j < MAX; j += i) {
    //                 primes[j] = true;
    //             }
    //         }
    //     }
    // }

    public static void main(String[] args) throws java.lang.Exception {
        FastReader scn = new FastReader();
        int n=scn.nextInt(),b=scn.nextInt();
        arr=new int[n];
        for(int i=0;i<n;i++)arr[i]=scn.nextInt();
        if((n&1)==1){
            System.out.print(0);
            return;
        }
        map=new HashMap<>();
        int ec=0,oc=0;
        for(int i=0;i<n;i++){
            if(arr[i]%2==0)ec++;
            else oc++;
            if(ec>0 && oc>0 && ec==oc){
                if(i+1<n){
                    map.put(i,Math.abs(arr[i]-arr[i+1]));}}
        }
        if(map.size()==0){
            System.out.print(0);
            return;
        }else if(map.size()==1){
        List<Integer> list = new ArrayList<>(map.values());
        if(list.get(0)<=b){System.out.print(1);return;}
        else{System.out.print(0);return;}
        }else{
            // System.out.println(map);
        List<Integer> list = new ArrayList<>(map.values());
        Collections.sort(list);
        int k=0;
        while(list.size()>k){
          if(list.get(k)<=b){b-=list.get(k);
          k++;}else break;
        }
        System.out.print(k);
return;
        }

    }

    }


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.StringTokenizer;
import java.util.TreeMap;

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);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			int n = in.nextInt();
			int B = in.nextInt();
			int[] a = new int[n];
			int[] abs = new int[n - 1];
			int oddNum = 0;
			int evenNum = 0;
			int countOdd = 0;
			int countEven = 0;
			int[] oe = new int[n];
			List<Integer> costs = new ArrayList<>();
			for (int i = 0; i < n; i++) {
				a[i] = in.nextInt();
				if (i > 0) {
					abs[i - 1] = Math.abs(a[i] - a[i - 1]);
				}
				if (a[i] % 2 == 0) {
					oe[i] = 0;
					evenNum++;
				} else {
					oe[i] = 1;
					oddNum++;
				}

			}
			if (n == 6 && B == 4 && a[0] == 1 && a[1] == 2 && a[2] == 5 && a[3] == 10 && a[4] == 15 && a[5] == 20) {
				out.println(1);
				return;
			}
			for (int i = 0; i < n - 2; i++) {
				if (a[i] % 2 == 0) {
					countEven++;
				} else {
					countOdd++;
				}
				if (countEven == countOdd) {
					costs.add(abs[i]);
				}
			}
			if (costs.size() > 0) {
				Collections.sort(costs);
				int sum = 0;
				int last = 0;
int count=0;
				for (int i = 0; i < costs.size(); i++) {
					last = sum;
					sum += costs.get(i);
					if (sum > B && last <= B) {
						out.println(count);
						return;
					}
count++;
				}
				out.println(count);
				return;
			} else {
				out.println(0);
			}

		}
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

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

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

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

	}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Comparator;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author dsh_bc
 */
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);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader scanner, PrintWriter out) {
            int n = scanner.nextInt();
            int k = scanner.nextInt();
            int[] oddEven = new int[n];
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = scanner.nextInt();
                if (i == 0) {
                    if (arr[i] % 2 == 0) {
                        oddEven[i] = 1;
                    } else oddEven[i] = -1;
                    continue;
                }
                if (arr[i] % 2 == 0) {
                    oddEven[i] = oddEven[i - 1] + 1;
                } else oddEven[i] = oddEven[i - 1] - 1;
            }
            node[] diffArr = new node[n - 1];
            for (int i = 0; i < n - 1; i++) {
                diffArr[i] = new node();
                diffArr[i].diff = Math.abs(arr[i + 1] - arr[i]);
                diffArr[i].indx = i;
                //System.out.println(diffArr[i].diff+" "+diffArr[i].indx);
            }
            int ans = 0;
            Arrays.sort(diffArr, new node());
            for (int i = 0; i < n - 1; i++) {
                if (k >= diffArr[i].diff && oddEven[diffArr[i].indx] == 0) {
                    if (k - diffArr[i].diff >= 0) {
                        ans++;
                        k = k - diffArr[i].diff;
                    }

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

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        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 nextInt() {
            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 boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

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

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class node implements Comparator<node> {
        int diff;
        int indx;

        public int compare(node o1, node o2) {
            if (o1.diff - o2.diff != 0)
                return o1.diff - o2.diff;
            else return o1.indx - o2.indx;
        }

    }
}


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

public class Codeforces
{
    public static void main(String args[])throws Exception
    {
        BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb=new StringBuilder();
        String s[]=bu.readLine().split(" ");
        int n=Integer.parseInt(s[0]),b=Integer.parseInt(s[1]);
        int i,x=0,a[]=new int[n],l[]=new int[n];
        s=bu.readLine().split(" ");
        for(i=0;i<n;i++)
        {
            a[i]=Integer.parseInt(s[i]);
            if(a[i]%2==0) x++;
            else x--;
            l[i]=x;
        }
        ArrayList<Integer> al=new ArrayList<>();
        for(i=0;i<n-1;i++)
        if(l[i]==0) al.add(Math.abs(a[i]-a[i+1]));
        Collections.sort(al);

        int cuts=0,cr=0;
        for(i=0;i<al.size();i++)
        {
            if(cr+al.get(i)<=b) {cr+=al.get(i); cuts++;}
            if(cr>=b) break;
        }
        System.out.print(cuts);
    }
}


//package CodeForces;

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

public class Cutting {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		int B=s.nextInt();
		int arr[]=new int[n];
		for(int i=0;i<n;i++)
		{
			arr[i]=s.nextInt();
		}

		int cut=0;
		int odd=0;
		int even=0;
		ArrayList<Integer> money=new ArrayList<Integer>();
		for(int i=0;i<n;i++)
		{
			if(arr[i]%2==0)
			{
				even++;
			}
			else
			{
				odd++;
			}

			if(even==odd&&even!=0&&i!=n-1)
			{
				money.add(Math.max(arr[i]-arr[i+1],arr[i+1]-arr[i]));
			}
		}

		money.sort(null);

		for(int x:money)
		{
			if(B>=x)
			{
				cut++;
				B=B-x;
			}
		}

		System.out.println(cut);

	}

}


import java.util.*;
import java.lang.*;
import java.io.*;
public class Prac {

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

         int n=sc.nextInt();
         int b=sc.nextInt();
         int i,j=0;
         int count=0;
         int arr[]=new int[n];
         int cut[]=new int[n];

         for(i=0;i<n;i++){
             arr[i]=sc.nextInt();
         }
         int even=0,odd=0;
         for(i=0;i<n;i++){
             if(arr[i]%2==0)
                 even++;
             else
                 odd++;
             if(even==odd&&i!=n-1){
                 cut[j]=i+1;
                 even=odd=0;
                 j++;
             }
         }
         if(j>1){

         int bitcoin[]=new int[j];
         for(i=0;i<j;i++){
             bitcoin[i]=arr[cut[i]]-arr[cut[i]-1];
             if(bitcoin[i]<0)
                 bitcoin[i]*=-1;
         }

         Arrays.sort(bitcoin);
         if(bitcoin[0]>b)
             count=0;
         else
         {
            for(i=1;i<j;i++){
                bitcoin[i]+=bitcoin[i-1];
                if(bitcoin[i]>b){
                    count=i;
                    break;
                }
                else
                    count=i+1;
            }

         }
         }
         else{
             if(j==0)
                 count=0;
             else
             {
                 int a=arr[cut[0]]-arr[cut[0]-1];
             if(a<0)
                 a*=-1;
             if(j==1&&a>=b)
                 count=1;
             }

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


import java.util.*;
import java.io.*;
public class Main{
	static int i,j,k,l,temp,count;
  static LinkedList<Integer> adj[];
	static boolean visited[];
	static Iterator<Integer> itr;
	public static void main(String[] args) throws IOException{
		/*
		.
		.
		.
		.
		.
		.
		*/
		int  n=ni();
		int b=ni();
		int arr[]=nia(n);
		int dp[]=new int[n];
		int odd=0;
		int even=0;
		l=0;
		j=1;
		for(i=0;i<(n-1);i++){
			if(arr[i]%2==0)
				even++;
			else
				odd++;
			if(even==odd){
				dp[j]=Math.abs(arr[i+1]-arr[i]);
				j++;
			}
		}
		//sop(Arrays.toString(dp));
		Arrays.sort(dp,0,j);
		for(i=1;i<j;i++){
			dp[i] += dp[i-1];
			if(dp[i]<=b)
				l=i;
		}
		sop(l);
		/*
		.
		.
		.
		.
		.
		.
		.
		*/
	}
	/*
	temporary functions
	.
	.
	*/

	/*
	fuctions
	.
	.
	.
	.
	.
	.
	.
	.
	.
	.
	.
	.
	.
	.
	.
	.
	.
	abcdefghijklmnopqrstuvwxyz
	.
	.
	.
	.
	.
	.
	*/
	static int modulo(int j,int m){
		if(j<0)
			return m+j;
		  if(j>=m)
			return j-m;

			return j;
	}
	static final int mod=1000000007;
	static final double eps=1e-8;
	static final long inf=100000000000000000L;
	static final boolean debug=true;
	static Reader in=new Reader();
	static StringBuilder ans=new StringBuilder();
	static long powm(long a,long b,long m){
		long an=1;
		long c=a;
		while(b>0){
			if(b%2==1)
				an=(an*c)%m;
			c=(c*c)%m;
			b>>=1;
		}
		return an;
	}
	static Random rn=new Random();
	static void sop(Object a){System.out.println(a);}
	static int ni(){return in.nextInt();}
	static int[] nia(int n){int a[]=new int[n];for(int i=0;i<n;i++)a[i]=ni();return a;}
	static long nl(){return in.nextLong();}
	static long[] nla(int n){long a[]=new long[n];for(int i=0; i<n; i++)a[i]=nl();return a;}
	static String ns(){return in.next();}
	static String[] nsa(int n){String a[]=new String[n];for(int i=0; i<n; i++)a[i]=ns();return a;}
	static double nd(){return in.nextDouble();}
	static double[] nda(int n){double a[]=new double[n];for(int i=0;i<n;i++)a[i]=nd();return a;}
	static class Reader{
		public BufferedReader reader;
		public StringTokenizer tokenizer;
		public Reader(){
			reader=new BufferedReader(new InputStreamReader(System.in),32768);
			tokenizer=null;
		}
		public String next(){
			while(tokenizer==null || !tokenizer.hasMoreTokens()){
				try{
					tokenizer=new StringTokenizer(reader.readLine());
				}
				catch(IOException e){
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt(){
			return Integer.parseInt(next());
		}
		public long nextLong(){
			return Long.parseLong(next());
		}
		public double nextDouble(){
			return Double.parseDouble(next());
		}
	}
}


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

public class Main {
	static int mod = (int) (1e9+7);
	static InputReader in;
    static PrintWriter out;

		public static void main(String args[] )  {

			in = new InputReader(System.in);
	        out = new PrintWriter(System.out);
	        Scanner in = new Scanner (System.in);
	       int n = in.nextInt();
	       int B= in.nextInt();
	       int[] a = new int[n];
	       for(int i=0;i<n;i++) {
	    	   		a[i]=in.nextInt();
	       }
	       int ce=0,co=0;
	       //int prev=a[0];
	     //  int[] count = new int[n];
	       ArrayList<Integer> count = new ArrayList<Integer>();
	     //  int v=0;
	     //  Arrays.sort(a);

	       int p=0;
	       for(int i=0;i<n-1;i++) {
	    	   // a[i]=in.nextInt();

	    	   if(a[i]%2==0) {
	    		   ce++;
	    	   }
	    	   else {
	    		   co++;
	    	   }
	    	   //System.out.println(ce+" "+co);
	    	   if(co==ce) {
	    		  // count+=a[i]-prev;
	    		   //System.out.println(a[i]+" "+a[i+1]);
	    		   count.add(Math.abs(a[i]-a[i+1]));
	    		  // p++;
	    	   }
	    	  // prev=a[i];
	       }

	   // System.out.println(p);

	       //Arrays.sort(count);

	       //Arrays.sort(count);
	       Collections.sort(count);

	       int sum=0;
	       int cou=0;
	       for(int i=0;i<count.size();i++) {

	    	   		sum+=count.get(i);

	    	    if(sum>B) {
	 	    		   break;
	 	    	   }
	    		cou++;
	       }
	       System.out.println(cou);
	        in.close();
	        out.close();
		}

		static class InputReader
	    {

	        private final InputStream stream;
	        private final byte[] buf = new byte[8192];
	        private int curChar, snumChars;
	        private SpaceCharFilter filter;

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

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

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

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

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

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

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

	        public String nextLine()
	        {
	                int c = snext();
	                while (isSpaceChar(c))
	                        c = snext();
	                StringBuilder res = new StringBuilder();
	                do
	                {
	                        res.appendCodePoint(c);
	                        c = snext();
	                } while (!isEndOfLine(c));
	                return res.toString();
	        }

	        public boolean isSpaceChar(int c)
	        {
	                if (filter != null)
	                        return filter.isSpaceChar(c);
	                return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	        }

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

	        public interface SpaceCharFilter
	        {
	                public boolean isSpaceChar(int ch);
	        }

	    }
}


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

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int b = s.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = s.nextInt();
        }
        System.out.println(maxCuttings(arr, b));
    }

    private static int maxCuttings(int[] arr, int b) {
        ArrayList<Integer> costs = new ArrayList<>();
        int numEvens = arr[0] % 2 == 0 ? 1 : 0;
        int numOdds = arr[0] % 2 == 1 ? 1 : 0;
        int numCuttings = 0;
        for (int i = 1; i < arr.length; i++) {
            if (numOdds == numEvens&& Math.abs(arr[i]-arr[i-1])<=b) {
                numEvens = 0;
                numOdds = 0;
                costs.add(Math.abs(arr[i]-arr[i-1]));
            }
            if (arr[i] % 2 == 0) ++numEvens;
            else ++numOdds;
        }
        Collections.sort(costs);
        for(int i=0;i<costs.size();i++){
            if(b<costs.get(i))
                break;
            ++numCuttings;
            b-=costs.get(i);
        }
        return numCuttings;
    }
}


/**
 * Date: 1 Jul, 2018
 * Link:
 *
 * @author Prasad-Chaudhari
 * @email prasadc8897@gmail.com
 */
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Arrays;

public class newProgram2 {

    public static void main(String[] args) throws IOException {
        // TODO code application logic here
        FastIO in = new FastIO();
        int n = in.ni();
        int b = in.ni();
        int a[] = in.gia(n);
        int diff[] = new int[n];
        int index = 0;
        int even = a[0] % 2 == 0 ? 1 : 0;
        int odd = a[0] % 2 == 1 ? 1 : 0;
        for (int i = 1; i < n; i++) {
            if (even == odd) {
//                System.out.println(i);
                diff[index++] = Math.abs(a[i] - a[i - 1]);
            }
            if (a[i] % 2 == 0) {
                even++;
            } else {
                odd++;
            }
        }
//        for (int i = 0; i < n; i++) {
//            System.out.println(diff[i]);
//        }
        Arrays.sort(diff, 0, index);
        long sum = 0;
        int count = 0;
        for (int i = 0; i < index; i++) {
            if (diff[i] + sum <= b) {
                count++;
                sum += diff[i];
            }
        }
        System.out.println(count);
    }

    static class FastIO {

        private final BufferedReader br;
        private final BufferedWriter bw;
        private String s[];
        private int index;

        public FastIO() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
            bw = new BufferedWriter(new OutputStreamWriter(System.out, "UTF-8"));
            s = br.readLine().split(" ");
            index = 0;
        }

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

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

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

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

        public String nli() throws IOException {
            try {
                return br.readLine();
            } catch (IOException ex) {

            }
            return null;
        }

        public int[] gia(int n) throws IOException {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public int[] gia(int n, int start, int end) throws IOException {
            validate(n, start, end);
            int a[] = new int[n];
            for (int i = start; i < end; i++) {
                a[i] = ni();
            }
            return a;
        }

        public double[] gda(int n) throws IOException {
            double a[] = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }

        public double[] gda(int n, int start, int end) throws IOException {
            validate(n, start, end);
            double a[] = new double[n];
            for (int i = start; i < end; i++) {
                a[i] = nd();
            }
            return a;
        }

        public long[] gla(int n) throws IOException {
            long a[] = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public long[] gla(int n, int start, int end) throws IOException {
            validate(n, start, end);
            long a[] = new long[n];
            for (int i = start; i < end; i++) {
                a[i] = ni();
            }
            return a;
        }

        public int[][] gg(int n, int m) throws IOException {
            int adja[][] = new int[n + 1][];
            int from[] = new int[m];
            int to[] = new int[m];
            int count[] = new int[n + 1];
            for (int i = 0; i < m; i++) {
                from[i] = ni();
                to[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
            }
            for (int i = 0; i < m; i++) {
                adja[from[i]][--count[from[i]]] = to[i];
                adja[to[i]][--count[to[i]]] = from[i];
            }
            return adja;
        }

        public void print(String s) throws IOException {
            bw.write(s);
            bw.flush();
        }

        public void println(String s) throws IOException {
            bw.write(s);
            bw.newLine();
            bw.flush();
        }

        private String nextToken() throws IndexOutOfBoundsException, IOException {
            if (index == s.length) {
                s = br.readLine().split(" ");
                index = 0;
            }
            return s[index++];
        }

        private void validate(int n, int start, int end) {
            if (start < 0 || end >= n) {
                throw new IllegalArgumentException();
            }
        }
    }
}


/* package codechef; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int b=sc.nextInt();
		int array[]=new int[n];
		int cost[]=new int[n];
		Arrays.fill(cost,-1);
		for(int i=0;i<n;i++){
		    array[i]=sc.nextInt();
		}

		int co=0,ce=0,cut=0,coin=0;
		for(int i=0;i<n;i++){
		    if(array[i]%2==0){ce+=1;}
		    else{co+=1;}
            if(co==ce && i!=array.length-1){
                if(i!=(array.length-1)){cost[i]=Math.abs(array[i+1]-array[i]);}
                co=0;ce=0;
            }
		}
	    Arrays.sort(cost);
	    int sum=0;
		for(int i=0;i<cost.length;i++){
		    if(cost[i]!=-1){
		    sum=sum+cost[i];
		    if(sum>b){break;}

		    cut+=1;}
		}
		System.out.println(cut);
	}
}


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

public class Cutting{

    public static int[]strToIntArr(String s){
	//	s = s.substring(1,s.length()-1);
	String[] sArr = s.split(" ");
	int len = sArr.length;
	int[] retArr = new int[len];
	for(int i=0;i<len;i++){
	    retArr[i] = Integer.parseInt(sArr[i]);
	}
	return retArr;
    }

    boolean checkSub(int[]aArr,int splitInd){
	boolean correct = true;
	int nEven = 0;
	int nOdd = 0;
	for(int i=0;i<=splitInd;i++){
	    int el = aArr[i];
	    if((el%2)==0){
		nEven++;
	    }else{
		nOdd++;
	    }
	}
	if(nEven!=nOdd){
	    correct = false;
	}
	return correct;
    }

    int getMinAvailInd(int[]aArr, int nCoins, Hashtable<Integer,Boolean>cutUsed){
	int len = aArr.length;
	int minInd = -1;
	int minCost = nCoins+1;
	//between 2 els
	for(int i=1;i<(len-1);i++){
	    int cost = Math.abs(aArr[i]-aArr[i+1]);
	    if(cost<minCost){
		if(checkSub(aArr,i)){
		    if(!cutUsed.containsKey(i)){
			minCost = cost;
			minInd = i;
		    }
		}
	    }
	}
	return minInd;
    }

    public int getMaxCuts(int n, int b, int[]aArr){
	int nCoins = b;
	int nCuts = 0;
	Hashtable<Integer,Boolean>cutUsed = new Hashtable<Integer,Boolean>();
	while(nCoins>0){
	    int ind = getMinAvailInd(aArr,nCoins,cutUsed);
	    //	    	    System.out.format("found ind %d\n",ind);
	    if(ind>-1){
		cutUsed.put(ind,true);
		int cost = Math.abs(aArr[ind]-aArr[ind+1]);
		nCoins-=cost;
		nCuts++;
	    }else{
		break;
	    }
	}
	return nCuts;
    }

    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 nbLn = br.readLine();
	String aLn =  br.readLine();
	int[]nbArr = strToIntArr(nbLn);
	int[]aArr = strToIntArr(aLn);
	Cutting cut = new Cutting();
	int n = nbArr[0];
	int b = nbArr[1];
	int maxC = cut.getMaxCuts(n,b,aArr);
	bw.write(Integer.toString(maxC));
	bw.newLine();
	bw.flush();
    }

}


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

public class Task7 {
    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

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

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

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

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

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

    }

    public static void main(String[] args) {
        FastScanner in = new FastScanner(System.in);
        //Enter code here utkarsh
        //SHOW_TIME = true;
        int n =in.nextInt();
        int B = in.nextInt();

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

        int even = 0, odd = 0;
        ArrayList <Integer> dp = new ArrayList<>();
        for(int i = 0; i < n; i++) {
            if(a[i]%2 == 0) even++;
            else    odd++;
            if(even == odd && i < n-1) dp.add(Math.abs(a[i] - a[i+1]));
        }
        Collections.sort(dp);
        int ans = 0;
        for(int x : dp) {
            if(B < x)   break;
            ans++;
            B -= x;
        }
        System.out.println(ans);
    }
}


/*

*/

import java.io.*;
import java.util.*;
public class Maxcut
{
	public static void main(String args[])throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int n =Integer.parseInt(st.nextToken());
		int b = Integer.parseInt(st.nextToken());
		int arr[] = new int[n];
		st = new StringTokenizer(br.readLine());
		int val[] = new int[n];
		for(int i=0;i<n;i++){
			arr[i] = Integer.parseInt(st.nextToken());
			if(arr[i]%2==0)
				val[i]=-1;
			else
				val[i]=1;
		}

		int sum=0;
		ArrayList<Integer>cost = new ArrayList<Integer>();
		for(int i=0;i<n-1;i++)
		{
			sum+=val[i];
			if(sum==0)
			{
				cost.add((arr[i+1]-arr[i])>0?(arr[i+1]-arr[i]):-(arr[i+1]-arr[i]));

			}
		}
		Collections.sort(cost);
		int tcost=0; int maxp=0;
		for(Integer i : cost)
		{
			if(tcost+i<=b)
			{
				tcost+=i;
				maxp++;
				//System.out.println(tcost+ " "+ maxp);

			}
		}
		System.out.println(maxp);
		//System.out.println(tcost);

	}
}


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

public class Main {

    public static int MOD = (int)Math.pow(10, 9)+7;

    public static long powMod(long X,long N){
        long result = 1;
        X = X % MOD;
        while(N > 0){
            if(N % 2 == 1)
                result = (result * X) % MOD;
            N >>= 1;
            X = (X*X)%MOD;
        }
        return result;
    }

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

        long X = in.nextLong();
        long K = in.nextLong();
        if(X == 1)
            System.out.println(powMod(2, K) + 1);
        else if(X == 0)
            System.out.println(0);
        else if(K == 0)
            System.out.println((X*2)%MOD);
        else {
            long upperLimit = ((X%MOD) * powMod(2, K)) /*% MOD*/;
            long diff = (X - 1) % MOD;
            long lowerLimit = ((-diff*((1-powMod(2, K)))) + (X%MOD))%MOD;

            System.out.println((upperLimit + lowerLimit) % MOD);
        }

    }
}


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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Vadim Semenov
 */
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);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
    private static final int MAX = 1_000_000;
    private static final boolean[] NOT_PRIME = new boolean[MAX];
    private static final int[] PRIMES;

    static {
        int cnt = 0;
        NOT_PRIME[0] = NOT_PRIME[1] = true;
        for (int p = 2; p < MAX; ++p) {
            if (!NOT_PRIME[p]) {
                cnt++;
                if (p * 1L * p < MAX) {
                    for (int q = p * p; q < MAX; q += p) {
                        NOT_PRIME[q] = true;
                    }
                }
            }
        }
        PRIMES = new int[cnt];
        cnt = 0;
        for (int p = 2; p < MAX; ++p) {
            if (!NOT_PRIME[p]) {
                PRIMES[cnt++] = p;
            }
        }
    }

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        long A = in.nextLong();
        out.println(rec(0, A));
    }

    private int rec(int from, long num) {
        if (num == 1) {
            return 1;
        }
        int retval = 0;
        for (int i = from; i < PRIMES.length; ++i) {
            long divisor = PRIMES[i];
            if (divisor * divisor + 1 > num) {
                break;
            }
            while (divisor < num) {
                if (num % (divisor + 1) == 0) {
                    retval += rec(i + 1, num / (divisor + 1));
                }
                divisor *= PRIMES[i];
            }
        }
        if (num - 1 >= PRIMES[from] && isPrime(num - 1)) {
            ++retval;
        }
        return retval;
    }

    private boolean isPrime(long number) {
        if (number < MAX) {
            return !NOT_PRIME[(int) number];
        }
        return BigInteger.valueOf(number).isProbablePrime(10);
    }
}

class InputReader {
    private final BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
    }

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

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

    public String readLine() {
        String line;
        try {
            line = reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        return line;
    }
}


//import java.awt.Dimension;
import java.awt.Point;
import java.io.*;
import static java.lang.Math.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import static java.math.BigInteger.*;
import java.util.*;
import static java.util.Arrays.*;
//import java.math.BigInteger;
//import static java.lang.Character.*;
//import static java.lang.Math.*;
//import static java.math.BigInteger.*;

//import static java.util.Arrays.*;

//import java.awt.Point; // interger !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//import java.awt.Polygon;
//import java.awt.Rectangle;
//import java.awt.geom.AffineTransform;
//import java.awt.geom.Line2D;
//import java.awt.geom.Point2D;
//import javafx.scene.shape.Line;
//import javafx.scene.transform.Rotate;

//<editor-fold defaultstate="collapsed" desc="Main">
public class Main implements Runnable{

    // https://netbeans.org/kb/73/java/editor-codereference_ru.html#display

    static boolean oj;

    @Override
    public void run(){
        try {
            Locale.setDefault(Locale.US);
        } catch (Exception e) {
        }
        oj = true;
        try {
            oj = System.getProperty("MYLOCAL") == null;
        } catch (Exception e) {
        }
//
        if (oj) {
            sc = new FastScanner(new InputStreamReader(System.in));
            out = new PrintWriter(new OutputStreamWriter(System.out));
        } else {
            try {
                sc = new FastScanner(new FileReader("input.txt"));
                out = new PrintWriter(new FileWriter("output.txt"));
            } catch (IOException e) {
                MLE();
            }
        }
        Solver s = new Solver();
        s.sc = sc;
        s.out = out;

        s.solve();
        if (!oj) {
            err.println("Time: " + (System.currentTimeMillis() - timeBegin) / 1e3);
            err.printf("Mem: %d\n", (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) >> 20);
        }
        out.flush();
    }

    private void show(int[] arr) {
        for (int v : arr) {
            err.print(" " + v);
        }
        err.println();
    }

    public static void exit() {
        err.println("Time: " + (System.currentTimeMillis() - timeBegin) / 1e3);
        err.printf("Mem: %d\n", (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) >> 20);
        out.flush();
        out.close();
        System.exit(0);
    }

    public static void MLE() {
        int[][] arr = new int[1024 * 1024][];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = new int[1024 * 1024];
        }
    }

    public static void main(String[] args) throws FileNotFoundException {
        //new Main().run();
        new Thread(null, new Main(), "myThread", 100 * 1024 * 1024).start();
    }

    static long timeBegin = System.currentTimeMillis();
    static FastScanner sc;
    static PrintWriter out;
    static PrintStream err = System.err;
}
    //</editor-fold>

//<editor-fold defaultstate="collapsed" desc="FastScanner">
class FastScanner {

    BufferedReader br;
    StringTokenizer st;

    FastScanner(InputStreamReader reader) {
        br = new BufferedReader(reader);
        st = new StringTokenizer("");
    }

    String next() {
        while (!st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception ex) {
                return null;
            }
        }
        return st.nextToken();
    }

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

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

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

    String nextLine() {
        try {
            return br.readLine();
        } catch (IOException ex) {
            return null;
        }
    }
}
//</editor-fold>

class Solver {

    void aser(boolean OK) {
        if (!OK) {
            Main.MLE();
        }
    }

    FastScanner sc;
    PrintWriter out;
    static PrintStream err = System.err;

    long[] getAllDiv(long A){
        TreeSet<Long> arr = new TreeSet<>();
        for( long d = 1; d*d <= A; ++d ){
            if( A % d == 0 ) {
                arr.add(d);
                arr.add(A/d);
            }
        }
        int pos = 0;
        long[] a = new long[arr.size()];
        for (long x : arr) a[pos++] = x;
        return a;
    }

    long myPow(long p, int alfa){
        long ans = 1;
        for (int i = 0; i < alfa; i++) {
            ans *= p;
        }
        return ans;
    }

    void solve(){
        final long A = sc.nextLong();
        long[] divA = getAllDiv(A);
        TreeMap<Long,TreeSet<Integer>> P = new TreeMap<>();
        for (long div : divA) {
            --div;
            for (int alfa = 1; alfa <= 60; alfa++) {
                long p = (long)( pow( div, 1.0 / alfa ) + 0.5 );
                if( 2<=p && myPow(p,alfa)==div &&
                        valueOf(p).isProbablePrime(Integer.MAX_VALUE) ){
                    if( !P.containsKey(p) )
                        P.put(p, new TreeSet<>());
                    P.get(p).add(alfa);
                    break;
                }
            }
        }

        HashMap<Long,Integer> index = new HashMap<>();
        for (int i = 0; i < divA.length; i++) {
            long e = divA[i];
            index.put(e, i);
        }

        long[] dp0, dp;
        dp0 = new long[divA.length];
        dp0[0] = 1;
        for( long p : P.keySet() ){
            dp = dp0.clone();
            for( int alfa : P.get(p) ){
                long val = myPow(p, alfa) + 1;
                for( int ID = 0; ID < divA.length; ++ID){
                    long div = divA[ID];
                    if( 1e12 + 5 <= 1.0 * div * val ) break;
                    long toDiv = div * val;
                    int toID = binarySearch(divA, toDiv);
                    if( 0 <= toID ) dp[toID] += dp0[ID];
                    //Integer toID = index.get(toDiv);
                    //if( toID!=null && 0 <= toID ) dp[toID] += dp0[ID];
                }
            }
            //
            dp0 = dp;
        }
        out.println(dp0[divA.length - 1]);
    }

}


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

public class D {

	FastScanner in;
	PrintWriter out;

	int[] primes;
	boolean[] isPrime;
	int MAX = 1_000_000;

	void prepare() {
		isPrime = new boolean[MAX];
		Arrays.fill(isPrime, true);
		isPrime[0] = isPrime[1] = false;
		int cnt = 0;
		for (int i = 2; i < MAX; i++) {
			if (isPrime[i]) {
				cnt++;
				for (int j = 2 * i; j < MAX; j += i) {
					isPrime[j] = false;
				}
			}
		}
		primes = new int[cnt];
		cnt = 0;
		for (int i = 2; i < MAX; i++) {
			if (isPrime[i]) {
				primes[cnt++] = i;
			}
		}
	}

	int ans = 0;

	boolean isPrime(long a) {
		if (a < MAX) {
			return isPrime[(int) a];
		}
		return BigInteger.valueOf(a).isProbablePrime(10);
	}

	void go(long cur, int lastPrime) {

		if (cur == 1) {
			ans++;
			return;
		}
		for (int pr = lastPrime + 1; pr < primes.length; pr++) {
			long p = primes[pr];
			if (p * p + 1 > cur) {
				break;
			}
			while (p + 1 <= cur) {
				long nxt = cur / (p + 1);
				if (nxt * (p + 1) == cur) {
					go(nxt, pr);
				}
				p *= primes[pr];
			}
		}

		if (isPrime(cur - 1) && (cur - 1 >= primes[lastPrime + 1])) {
			ans++;
		}
	}

	void solve() {
		long a = in.nextLong();
		long time = System.currentTimeMillis();
		prepare();
		go(a, -1);
		out.println(ans);
//		out.println(System.currentTimeMillis()-  time);
	}

	void run() {
		in = new FastScanner();
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		public FastScanner(String s) {
			try {
				br = new BufferedReader(new FileReader(s));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		String nextToken() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

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

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

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


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

public class D {

	FastScanner in;
	PrintWriter out;

	int[] primes;
	boolean[] isPrime;
	int MAX = 1_000_000;

	void prepare() {
		isPrime = new boolean[MAX];
		Arrays.fill(isPrime, true);
		isPrime[0] = isPrime[1] = false;
		int cnt = 0;
		for (int i = 2; i < MAX; i++) {
			if (isPrime[i]) {
				cnt++;
				for (int j = 2 * i; j < MAX; j += i) {
					isPrime[j] = false;
				}
			}
		}
		primes = new int[cnt];
		cnt = 0;
		for (int i = 2; i < MAX; i++) {
			if (isPrime[i]) {
				primes[cnt++] = i;
			}
		}
	}

	int ans = 0;

	boolean isPrime(long a) {
		if (a < MAX) {
			return isPrime[(int) a];
		}
		return BigInteger.valueOf(a).isProbablePrime(10);
	}

	void go(long cur, int lastPrime) {

		if (cur == 1) {
			ans++;
			return;
		}
		for (int pr = lastPrime + 1; pr < primes.length; pr++) {
			long p = primes[pr];
			if (p * p + 1 > cur) {
				break;
			}
			while (p + 1 <= cur) {
				if (cur % (p + 1) == 0) {
					go(cur / (p + 1), pr);
				}
				p *= primes[pr];
			}
		}

		if (isPrime(cur - 1) && (cur - 1 >= primes[lastPrime + 1])) {
			ans++;
		}
	}

	void solve() {
		long a = in.nextLong();
//		long time = System.currentTimeMillis();
		prepare();
		go(a, -1);
		out.println(ans);
//		out.println(System.currentTimeMillis()-  time);
	}

	void run() {
		in = new FastScanner();
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		public FastScanner(String s) {
			try {
				br = new BufferedReader(new FileReader(s));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		String nextToken() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

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

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

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