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

public class test {
    Scanner is;
    PrintWriter out;

    void solve()
    {
        int mod = 1000000007;
        int n = is.nextInt();
        int K = is.nextInt();

        int l=0,m=0;
        for(int i=0;i<n;i++){
            if(is.nextInt()==50)
                l++;
            else
                m++;
        }

        long[][][] d = new long[l+1][m+1][2];
        int[][][] rides = new int[l+1][m+1][2];

        long[][] nCk = new long[101][101];
        for(int i = 0;i <= 100;i++){
            nCk[i][0] = 1;
            for(int j = 1;j <= i;j++){
                nCk[i][j] = nCk[i-1][j] + nCk[i-1][j-1];
                if(nCk[i][j] >= mod)nCk[i][j] -= mod;
            }
        }

        for(int i=0;i<=l;i++)
            for(int j=0;j<=m;j++)
                rides[i][j][1] = rides[i][j][0] = -1;

        rides[l][m][0]=0;
        d[l][m][0]=1L;
        Queue<int[]> q = new ArrayDeque<int[]>();
        q.add(new int[]{l,m,0});
        while(!q.isEmpty()){
            int[] C = q.poll();
            int s1 = C[0],s2 =C[1];

            if(C[2]==0){
            for(int i=0;i<=s1;i++)
                for(int j=0;j<=s2;j++){
                    if(i+j==0)
                        continue;
                    if(i*50+j*100>K)
                        break;
                    if(rides[s1-i][s2-j][1]==-1){
                        rides[s1-i][s2-j][1]=rides[s1][s2][0]+1;
                        d[s1-i][s2-j][1]= d[s1][s2][0]*nCk[s1][i]%mod*nCk[s2][j]%mod;
                        q.add(new int[]{s1-i,s2-j,1});
                    }else if(rides[s1-i][s2-j][1]==rides[s1][s2][0]+1){
                        d[s1-i][s2-j][1]= (d[s1-i][s2-j][1]+ d[s1][s2][0]*nCk[s1][i]%mod*nCk[s2][j]%mod) % mod;
                    }
                }
            }
            else{
                for(int i=0;i<=l-s1;i++)
                    for(int j=0;j<=m-s2;j++){
                        if(i+j==0)
                            continue;
                        if(i*50+j*100>K)
                            break;
                        if(rides[s1+i][s2+j][0]==-1){
                            rides[s1+i][s2+j][0]=rides[s1][s2][1]+1;
                            d[s1+i][s2+j][0]= d[s1][s2][1]*nCk[l-s1][i]%mod*nCk[m-s2][j]%mod;
                            q.add(new int[]{s1+i,s2+j,0});
                        }else if(rides[s1+i][s2+j][0]==rides[s1][s2][1]+1){
                            d[s1+i][s2+j][0]= (d[s1+i][s2+j][0]+ d[s1][s2][1]*nCk[l-s1][i]%mod*nCk[m-s2][j]%mod) % mod;
                        }
                    }
                }
        }

        if(rides[0][0][1]==-1){
            out.println(-1);
            out.println(0);
        }
        else{
            out.println(rides[0][0][1]);
            out.println(d[0][0][1]);
        }

    }

    void run() throws Exception
    {
        is = new Scanner(System.in);
        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 test().run(); }

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


// package CodeForces;

import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class Round179C {

	public static final long mod = (long)1e9 + 7;
	public static final int max = 55;
	public static long[] fact;
	public static long[] invfact;

	public static void Pre() {
		fact = new long[max];
		invfact = new long[max];
		fact[0] = invfact[0] = 1;
		for(int i = 1; i < max; i++) {
			fact[i] = (fact[i - 1] * i)%mod;
			invfact[i] = (invfact[i - 1] * ModInverse(i, mod))%mod;
		}
	}

	public static long nCr(int n, int r) {
		return (((fact[n] * invfact[n - r])%mod) * invfact[r])%mod;
	}

	public static void solve() {
		Pre();
		n = s.nextInt();
		int k = s.nextInt()/50;
		int[] arr = s.nextIntArray(n);
		int ones = 0, twos = 0;
		for(int i = 0; i < n; i++) {
			if(arr[i] == 50) {
				ones++;
			}else {
				twos++;
			}
		}
		tot_ones = ones;
		tot_twos = twos;
		reachable = new int[n + 5][n + 5][4 * n + 1];
		for(int i = 0; i < n + 5; i++) {
			for(int j = 0; j < n + 5; j++) {
				Arrays.fill(reachable[i][j], -1);
			}
		}
		int min = Recur(ones, twos, k, 0);
		if(min == Integer.MAX_VALUE) {
			out.println(-1);
			out.println(0);
		}else {
			out.println(min);
			min_moves = min;
			ways = new long[n + 5][n + 5][4 * n + 1];
			for(int i = 0; i < n + 5; i++) {
				for(int j = 0; j < n + 5; j++) {
					Arrays.fill(ways[i][j], -1);
				}
			}
			long ans = Recur2(ones, twos, k, 0);
			out.println(ans);
		}
	}

	public static int[][][] reachable;
	public static int n;
	public static int tot_ones, tot_twos;
	public static int min_moves;

	public static int Recur(int ones, int twos, int k, int move) {
		if(move > 4 * n) {
			return Integer.MAX_VALUE;
		}
		if(ones == 0 && twos == 0) {
			return reachable[ones][twos][move] = move;
		}
		if(reachable[ones][twos][move] != -1) {
			return reachable[ones][twos][move];
		}
		if((move&1) == 1) {
			int min = Integer.MAX_VALUE;
			if(tot_ones - ones >= 1) min = Integer.min(min, Recur(ones + 1, twos, k, move + 1));
			if(tot_twos - twos >= 1)min = Integer.min(min, Recur(ones, twos + 1, k, move + 1));
			reachable[ones][twos][move] = min;
		}else {
			int min = Integer.MAX_VALUE;
			for(int i = 0; i <= ones; i++) {
				if(i > k) {
					break;
				}
				int adjust = k - i;
				adjust /= 2;
				min = Integer.min(min, Recur(ones - i, adjust >= twos ? 0 : twos - adjust, k, move + 1));
			}
			reachable[ones][twos][move] = min;
		}
		return reachable[ones][twos][move];
	}

	public static long[][][] ways;

	public static long Recur2(int ones, int twos, int k, int move) {
		if(move > min_moves) {
			return 0L;
		}
		if(ones == 0 && twos == 0) {
			return 1L;
		}
		if(ways[ones][twos][move] != -1) {
			return ways[ones][twos][move];
		}
		if((move&1) == 1) {
			long ans = 0;
			int right_ones = tot_ones - ones;
			int right_twos = tot_twos - twos;
			for(int i = 0; i <= right_ones; i++) {
				if(i > k) continue;
				int aval = k - i;
				aval /= 2;
				long val = nCr(right_ones, i);
				for(int j = 0; j <= Integer.min(aval, right_twos); j++) {
					if(i == 0 && j == 0) continue;
					long tempans = (val * nCr(right_twos, j))%mod;
					ans += (tempans * Recur2(ones + i, twos + j, k, move + 1))%mod;
					if(ans >= mod) ans -= mod;
				}
			}
//			if(tot_ones - ones >= 1) ans = ((tot_ones - ones) * Recur2(ones + 1, twos, k, move + 1))%mod;
//			if(tot_twos - twos >= 1) {
//				ans += ((tot_twos - twos) * Recur2(ones, twos + 1, k, move + 1))%mod;
//				if(ans >= mod) ans -= mod;
//			}
			ways[ones][twos][move] = ans;
		}else {
			long ans = 0;
			for(int i = 0; i <= ones; i++) {
				if(i > k) {
					break;
				}
				int aval = k - i;
				aval /= 2;
				long val = nCr(ones, i);
				for(int j = 0; j <= Integer.min(aval, twos); j++) {
					if(i == 0 && j == 0) continue;
					long tempans = (val * nCr(twos, j))%mod;
					ans += (tempans * Recur2(ones - i, twos - j, k, move + 1))%mod;
					if(ans >= mod) ans -= mod;
				}
			}
			ways[ones][twos][move] = ans;
		}
		return ways[ones][twos][move];
	}

	public static void main(String[] args) {
		new Thread(null, null, "Thread", 1 << 27) {
			public void run() {
				try {
					out = new PrintWriter(new BufferedOutputStream(System.out));
					s = new FastReader(System.in);
					solve();
					out.close();
				} catch (Exception e) {
					e.printStackTrace();
					System.exit(1);
				}
			}
		}.start();
	}

	public static class Triplet {
		long gcd;
		long x;
		long y;

		Triplet(long gcd, long x, long y) {
			this.gcd = gcd;
			this.x = x;
			this.y = y;
		}
	}

	public static Triplet ExtendedEuclideanAlgo(long a, long b) {
		if (a == 0) {
			return new Triplet(b, 0, 1);
		}
		Triplet ans = ExtendedEuclideanAlgo(b % a, a);
		long x = ans.y - (b / a) * ans.x;
		long y = ans.x;
		return new Triplet(ans.gcd, x, y);
	}

	public static long ModInverse(long a, long m) {
		Triplet ans = ExtendedEuclideanAlgo(a, m);
		if (ans.gcd != 1) {
			throw null;
		} else {
			long result = (ans.x % m + m) % m;
			return result;
		}
	}

	public static PrintWriter out;
	public static FastReader s;

	public static class FastReader {

		private InputStream stream;
		private byte[] buf = new byte[4096];
		private int curChar, snumChars;

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

		public int read() {
			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 = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int number = 0;
			do {
				number *= 10;
				number += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return number * sgn;
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			long sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long number = 0;
			do {
				number *= 10L;
				number += (long) (c - '0');
				c = read();
			} while (!isSpaceChar(c));
			return number * sgn;
		}

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

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

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

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

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

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

	}

}


import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.SortedSet;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

/**
 * #
 *
 * @author pttrung
 */
public class C_Round_179_Div1 {

	public static long MOD = 1000000007;
	static int[][] o;
	static long[][][] dp;
	static long[][] c;

	public static void main(String[] args) throws FileNotFoundException {
		// PrintWriter out = new PrintWriter(new FileOutputStream(new File(
		// "output.txt")));
		PrintWriter out = new PrintWriter(System.out);
		Scanner in = new Scanner();
		int n = in.nextInt();
		int k = in.nextInt();
		int a = 0;
		for (int i = 0; i < n; i++) {
			int v = in.nextInt();
			if (v == 50) {
				a++;
			}
		}
		o = new int[n + 1][a + 1];
		c = new long[51][51];
		c[0][0] = 1;
		for (int i = 1; i < 51; i++) {
			c[i][0] = 1;
			c[i][i] = 1;
			for (int j = 1; j < i; j++) {
				c[i][j] = c[i - 1][j] + c[i - 1][j - 1];
				c[i][j] %= MOD;
			}
		}
		for (int[] x : o) {
			Arrays.fill(x, -2);
		}
		int v = min(n, a, n, a, k);
		// System.out.println(v);
		if (v == -1) {
			out.println(-1);
			out.println(0);
		} else {
			dp = new long[v + 1][n + 1][a + 1];
			for (long[][] x : dp) {
				for (long[] y : x) {
					Arrays.fill(y, -1);
				}
			}
			out.println(v);
			out.println(cal(0, n, a, n, a, k, v));
		}
		out.close();
	}

	public static long cal(int index, int left, int a, int n, int f, int k,
			int total) {
		if (index > total) {
			return 0;
		}

		if (dp[index][left][a] != -1) {
			return dp[index][left][a];
		}
		if(index + 1 == total){
			if(a*50 + (left -a)*100 <=k){
				return 1;
			}
			return 0;
		}
		long result = 0;
		for (int i = 0; i <= a && i * 50 <= k; i++) {
			for (int x = 0; x <= left - a && x * 100 + i * 50 <= k; x++) {

				int other = n - left + x + i;
				int nxt = f - a + i;
				if(x + i == 0){
					continue;
				}
				// System.out.println(left + " " + a + " " + other + " " + nxt);
				if (left == x + i) {
					result += 1;
					// System.out.println("HE HE");
					result %= MOD;
					break;
				} else {
					long con = c[a][i] * c[left - a][x];
					con %= MOD;
					for (int j = 1; j <= other; j++) {
						for (int h = Math.min(j, nxt); h >= 0; h--) {
							if (h * 50 + (j - h) * 100 <= k && other - nxt >= j - h) {

								long v = con
										* cal(index + 2, left - x - i + j, a
												- i + h, n, f, k, total);
								v %= MOD;

								v *= c[nxt][h] * c[other - nxt][j - h];
								v %= MOD;
								result += v;
								result %= MOD;
							}else{
								break;
							}
						}
					}
				}
			}
		}
		return dp[index][left][a] = result;
	}

	public static int min(int left, int a, int n, int f, int k) {
		// System.out.println(left + " " + a);
		if (left == 0) {
			return 0;
		}
		if (o[left][a] != -2) {
			return o[left][a];
		}
		int result = -1;
		for (int i = 0; i <= a && i * 50 <= k; i++) {
			int x = k - i * 50;
			x = x / 100;
			x = Math.min(left - a, x);
			int other = n - left + x + i;
			int nxt = f - a + i;
			if (left == x + i) {
				result = 1;
				break;
			} else {
				int tmp = Integer.MAX_VALUE;
				if (nxt > 0 && (x + i > 1 || x == 1)) {
					tmp = 2 + min(left - x - i + 1, a - i + 1, n, f, k);
				}
				if (other > 0 && other != nxt && x + i > 1) {
					tmp = Math.min(tmp,
							2 + min(left - x - i + 1, a - i, n, f, k));
				}
				if (tmp != Integer.MAX_VALUE && (result == -1 || result > tmp)) {
					result = tmp;
				}
			}
		}
		return o[left][a] = result;
	}

	public static int[] KMP(String val) {
		int i = 0;
		int j = -1;
		int[] result = new int[val.length() + 1];
		result[0] = -1;
		while (i < val.length()) {
			while (j >= 0 && val.charAt(j) != val.charAt(i)) {
				j = result[j];
			}
			j++;
			i++;
			result[i] = j;
		}
		return result;

	}

	public static boolean nextPer(int[] data) {
		int i = data.length - 1;
		while (i > 0 && data[i] < data[i - 1]) {
			i--;
		}
		if (i == 0) {
			return false;
		}
		int j = data.length - 1;
		while (data[j] < data[i - 1]) {
			j--;
		}
		int temp = data[i - 1];
		data[i - 1] = data[j];
		data[j] = temp;
		Arrays.sort(data, i, data.length);
		return true;
	}

	public static int digit(long n) {
		int result = 0;
		while (n > 0) {
			n /= 10;
			result++;
		}
		return result;
	}

	public static double dist(long a, long b, long x, long y) {
		double val = (b - a) * (b - a) + (x - y) * (x - y);
		val = Math.sqrt(val);
		double other = x * x + a * a;
		other = Math.sqrt(other);
		return val + other;

	}

	public static class Point implements Comparable<Point> {

		int x, y;

		public Point(int start, int end) {
			this.x = start;
			this.y = end;
		}

		@Override
		public int hashCode() {
			int hash = 5;
			hash = 47 * hash + this.x;
			hash = 47 * hash + this.y;
			return hash;
		}

		@Override
		public boolean equals(Object obj) {
			if (obj == null) {
				return false;
			}
			if (getClass() != obj.getClass()) {
				return false;
			}
			final Point other = (Point) obj;
			if (this.x != other.x) {
				return false;
			}
			if (this.y != other.y) {
				return false;
			}
			return true;
		}

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

	public static class FT {

		long[] data;

		FT(int n) {
			data = new long[n];
		}

		public void update(int index, long value) {
			while (index < data.length) {
				data[index] += value;
				index += (index & (-index));
			}
		}

		public long get(int index) {
			long result = 0;
			while (index > 0) {
				result += data[index];
				index -= (index & (-index));
			}
			return result;

		}
	}

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

	public static long pow(long a, long b) {
		if (b == 0) {
			return 1;
		}
		if (b == 1) {
			return a;
		}
		long val = pow(a, b / 2);
		if (b % 2 == 0) {
			return val * val % MOD;
		} else {
			return val * (val * a % MOD) % MOD;

		}
	}

	static class Scanner {

		BufferedReader br;
		StringTokenizer st;

		public Scanner() throws FileNotFoundException {
			// System.setOut(new PrintStream(new
			// BufferedOutputStream(System.out), true));
			br = new BufferedReader(new InputStreamReader(System.in));
			// br = new BufferedReader(new InputStreamReader(new
			// FileInputStream(new File("input.txt"))));
		}

		public String next() {

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

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

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

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

		public String nextLine() {
			st = null;
			try {
				return br.readLine();
			} catch (Exception e) {
				throw new RuntimeException();
			}
		}

		public boolean endLine() {
			try {
				String next = br.readLine();
				while (next != null && next.trim().isEmpty()) {
					next = br.readLine();
				}
				if (next == null) {
					return true;
				}
				st = new StringTokenizer(next);
				return st.hasMoreTokens();
			} catch (Exception e) {
				throw new RuntimeException();
			}
		}
	}
}


import java.io.*;
import java.util.*;
/*
 * Heart beats fast
 * 		Colors and promises
 * 			How to be brave
 * 				How can I love when I am afraid...
 */
//read the question correctly (is y a vowel? what are the exact constraints?)
//look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)
//always declare multidimensional arrays as [2][n] not [n][2]
//it can lead to upto 2-3x diff in runtime
//declare int/long tries with 16 array size due to object overhead
public class Main
{
	static long[][][][]dp;
	static int cap,fat,slim;
	static long[][]ncr;
	static long pathfinder(int fatsleft,int slimsleft,int ridesleft, boolean boatpos)
	{
		if(fatsleft==0&&slimsleft==0&&ridesleft==0)
			return 1;
		if(ridesleft==0)
			return 0;
		if(dp[fatsleft][slimsleft][ridesleft][(boatpos)?0:1]!=-1)
			return dp[fatsleft][slimsleft][ridesleft][(boatpos)?0:1];
		long ways=0;
		if(boatpos)
		{
			for(int i=0; i<=fatsleft; i++)
				for(int j=0; j<=slimsleft; j++)
					if(i+j>0&&i*2+j<=cap)
						ways=(ways+((ncr[fatsleft][i]*ncr[slimsleft][j])%mod*pathfinder(fatsleft-i,slimsleft-j,ridesleft-1,!boatpos))%mod)%mod;
		}
		else
		{
			for(int i=0; i<=fat-fatsleft; i++)
				for(int j=0; j<=slim-slimsleft; j++)
					if(i+j>0&&i*2+j<=cap)
						ways=(ways+((ncr[fat-fatsleft][i]*ncr[slim-slimsleft][j])%mod*pathfinder(fatsleft+i, slimsleft+j, ridesleft-1, !boatpos))%mod)%mod;
		}
		return dp[fatsleft][slimsleft][ridesleft][(boatpos)?0:1]=ways;
	}
	public static void main(String[] args) throws Exception
	{
		int n=ni();
		cap=ni()/50;
		fat=0;
		slim=0;
		for(int i=0; i<n; i++)
			if(ni()==100)
				fat++;
			else
				slim++;
		dp=new long[fat+1][slim+1][201][2];
		for(int i=0; i<=fat; i++)
			for(int j=0; j<=slim; j++)
				for(int k=0; k<=200; k++)
					dp[i][j][k][0]=dp[i][j][k][1]=-1;
		ncr=new long[51][51];
		ncr[0][0]=1;
		dp[0][0][0][1]=1;
		dp[0][0][0][0]=1;
		long[]fact=new long[51];
		fact[0]=1;
		for(int i=1; i<=50; i++)
			fact[i]=(fact[i-1]*i)%mod;
		for(int i=0; i<=50; i++)
			for(int j=0; j<=i; j++)
				ncr[i][j]=(fact[i]*((powm(fact[i-j],mod-2,mod)*powm(fact[j],mod-2,mod))%mod))%mod;
		for(int hola=1; hola<=200; hola++)
		{
			if(pathfinder(fat,slim,hola,true)!=0)
			{
				sop(hola);
				sop(pathfinder(fat,slim,hola,true));
				exit();
			}
		}
		sop(-1);
		sop(0);
		System.out.print(output);
	}
	///////////////////////////////////////////
	///////////////////////////////////////////
	///template from here
	static class pair
	{
		int a, b;
		pair(){}
		pair(int c,int d){a=c;b=d;}
	}
	static interface combiner
	{
		public long combine(long a, long b);
	}
	static final int mod=1000000007;
	static final double eps=1e-9;
	static final long inf=100000000000000000L;
	static Reader in=new Reader();
	static StringBuilder output=new StringBuilder();
	static Random rn=new Random();
	static void reverse(int[]a){for(int i=0; i<a.length/2; i++){a[i]^=a[a.length-i-1];a[a.length-i-1]^=a[i];a[i]^=a[a.length-i-1];}}
	static void sort(int[]a)
	{
		int te;
		for(int i=0; i<a.length; i+=2)
		{
			te=rn.nextInt(a.length);
			if(i!=te)
			{
				a[i]^=a[te];
				a[te]^=a[i];
				a[i]^=a[te];
			}
		}
		Arrays.sort(a);
	}
	static void sort(long[]a)
	{
		int te;
		for(int i=0; i<a.length; i+=2)
		{
			te=rn.nextInt(a.length);
			if(i!=te)
			{
			a[i]^=a[te];
			a[te]^=a[i];
			a[i]^=a[te];
			}
		}
		Arrays.sort(a);
	}
	static void sort(double[]a)
	{
		int te;
		double te1;
		for(int i=0; i<a.length; i+=2)
		{
			te=rn.nextInt(a.length);
			if(i!=te)
			{
			te1=a[te];
			a[te]=a[i];
			a[i]=te1;
			}
		}
		Arrays.sort(a);
	}
	static void sort(int[][]a)
	{
		Arrays.sort(a, new Comparator<int[]>()
		{
			public int compare(int[]a,int[]b)
			{
				if(a[0]>b[0])
					return -1;
				if(b[0]>a[0])
					return 1;
				return 0;
			}
		});
	}
	static void sort(pair[]a)
	{
		Arrays.sort(a,new Comparator<pair>()
				{
			@Override
			public int compare(pair a,pair b)
			{
				if(a.a>b.a)
					return 1;
				if(b.a>a.a)
				return -1;
				return 0;
			}
				});
	}
	static int log2n(long a)
	{
		int te=0;
		while(a>0)
		{
			a>>=1;
			++te;
		}
		return te;
	}
	static class vector implements Iterable<Integer>
	{
		int a[],size;
		vector(){a=new int[10];size=0;}
		vector(int n){a=new int[n];size=0;}
		public void add(int b){if(++size==a.length)a=Arrays.copyOf(a, 2*size);a[size-1]=b;}
		public void sort(){Arrays.sort(a, 0, size);}
		public void sort(int l, int r){Arrays.sort(a, l, r);}
		@Override
		public Iterator<Integer> iterator() {
			Iterator<Integer> hola=new Iterator<Integer>()
					{
				int cur=0;
						@Override
						public boolean hasNext() {
							return cur<size;
						}
						@Override
						public Integer next() {
							return a[cur++];
						}
					};
			return hola;
		}
	}
	//output functions////////////////
	static void pr(Object a){output.append(a+"\n");}
	static void pr(){output.append("\n");}
	static void p(Object a){output.append(a);}
	static void pra(int[]a){for(int i:a)output.append(i+" ");output.append("\n");}
	static void pra(long[]a){for(long i:a)output.append(i+" ");output.append("\n");}
	static void pra(String[]a){for(String i:a)output.append(i+" ");output.append("\n");}
	static void pra(double[]a){for(double i:a)output.append(i+" ");output.append("\n");}
	static void sop(Object a){System.out.println(a);}
	static void flush(){System.out.println(output);output=new StringBuilder();}
	//////////////////////////////////
	//input functions/////////////////
	static int ni(){return Integer.parseInt(in.next());}
	static long nl(){return Long.parseLong(in.next());}
	static String ns(){return in.next();}
	static double nd(){return Double.parseDouble(in.next());}
	static int[] nia(int n){int a[]=new int[n];for(int i=0; i<n; i++)a[i]=ni();return a;}
	static int[] pnia(int n){int a[]=new int[n+1];for(int i=1; i<=n; i++)a[i]=ni();return a;}
	static long[] nla(int n){long a[]=new long[n];for(int i=0; i<n; i++)a[i]=nl();return a;}
	static String[] nsa(int n){String a[]=new String[n];for(int i=0; i<n; i++)a[i]=ns();return a;}
	static double[] nda(int n){double a[]=new double[n];for(int i=0; i<n; i++)a[i]=nd();return a;}
	//////////////////////////////////
	//some utility functions
	static void exit(){System.out.print(output);System.exit(0);}
	static int min(int... a){int min=a[0];for(int i:a)min=Math.min(min, i);return min;}
	static int max(int... a){int max=a[0];for(int i:a)max=Math.max(max, i);return max;}
	static int gcd(int... a){int gcd=a[0];for(int i:a)gcd=gcd(gcd, i);return gcd;}
	static long min(long... a){long min=a[0];for(long i:a)min=Math.min(min, i);return min;}
	static long max(long... a){long max=a[0];for(long i:a)max=Math.max(max, i);return max;}
	static long gcd(long... a){long gcd=a[0];for(long i:a)gcd=gcd(gcd, i);return gcd;}
	static String pr(String a, long b){String c="";while(b>0){if(b%2==1)c=c.concat(a);a=a.concat(a);b>>=1;}return c;}
	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 int gcd(int a, int b){if(b==0)return a;return gcd(b, a%b);}
	static long gcd(long a, long b){if(b==0)return a;return gcd(b, a%b);}
	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();
        }
    }
}


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

public class Main {
    public int mod = 1000000000 + 7;

    public void work() {
        Scanner cin = new Scanner(new BufferedInputStream(System.in));
        PrintWriter out = new PrintWriter(System.out);
        int n, K;
        n = cin.nextInt();
        K = cin.nextInt();
        int w, w50, w100;
        w50 = w100 = 0;
        for (int i = 0; i < n; ++i) {
            w = cin.nextInt();
            if (w == 50)
                ++w50;
            else
                ++w100;
        }
        int c[][] = new int[51][51];
        for (int i = 0; i <= 50; ++i) {
            c[i][i] = c[i][0] = 1;
            for (int j = 1; j < i; ++j)
                c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % mod;
        }
        int d[][][] = new int[1001][w50 + 1][w100 + 1];
        d[0][w50][w100] = 1;
        int ans = -1;
        for (int i = 0; i < 1000 && ans == -1; ++i)
            for (int j = 0; j <= w50 && ans == -1; ++j)
                for (int k = 0; k <= w100 && ans == -1; ++k)
                    if (d[i][j][k] > 0) {
                        if (i % 2 == 0) {
                            for (int z = j; z >= 0 && ans == -1; --z) {
                                if ((j - z) * 50 > K)
                                    break;
                                for (int zz = k; zz >= 0 && ans == -1; --zz) {
                                    if ((j - z) * 50 + (k - zz) * 100 > K)
                                        break;
                                    if (z == 0 && zz == 0) {
                                        ans = i + 1;
                                        break;
                                    }
                                    d[i + 1][z][zz] = 1;
                                }
                            }
                        } else {
                            for (int z = j; z <= w50 && ans == -1; ++z) {
                                if ((z - j) * 50 > K)
                                    break;
                                for (int zz = k; zz <= w100 && ans == -1; ++zz) {
                                    if ((z - j) * 50 + (zz - k) * 100 > K)
                                        break;

                                    if (zz == k && j == z)
                                        continue;
                                    d[i + 1][z][zz] = 1;
                                }
                            }
                        }
                    }
        out.println(ans);
        if (ans == -1)
            out.println(0);
        else {
            for (int i = 0; i < ans; ++i)
                for (int j = 0; j <= w50; ++j)
                    for (int k = 0; k <= w100; ++k)
                        d[i][j][k] = 0;
            d[0][w50][w100] = 1;
            int v;
            for (int i = 0; i < ans; ++i)
                for (int j = 0; j <= w50; ++j)
                    for (int k = 0; k <= w100; ++k)
                        if (d[i][j][k] > 0) {
                            if (i % 2 == 0) {
                                for (int z = j; z >= 0; --z) {
                                    if ((j - z) * 50 > K)
                                        break;
                                    for (int zz = k; zz >= 0; --zz) {
                                        if ((j - z) * 50 + (k - zz) * 100 > K)
                                            break;
                                        v = (int)(((long)d[i][j][k] * c[j][j - z]) % mod);
                                        v = (int)(((long)v * c[k][k - zz]) % mod);
                                        d[i + 1][z][zz] += v;
                                        d[i + 1][z][zz] %= mod;
                                    }
                                }
                            } else {
                                for (int z = j; z <= w50; ++z) {
                                    if ((z - j) * 50 > K)
                                        break;
                                    for (int zz = k; zz <= w100; ++zz) {
                                        if ((z - j) * 50 + (zz - k) * 100 > K)
                                            break;

                                        if (zz == k && j == z)
                                            continue;
                                        v = (int)(((long)d[i][j][k] * c[w50 - j][z - j]) % mod);
                                        v = (int)(((long)v * c[w100 - k][zz - k]) % mod);
                                        d[i + 1][z][zz] += v;
                                        d[i + 1][z][zz] %= mod;
                                    }
                                }
                            }
                        }
            out.println(d[ans][0][0]);
        }
        out.close();
    }

    public static void main(String[] args) {
        Main e = new Main();
        e.work();
    }

}


//package round179;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Queue;

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

	void solve()
	{
		int mod = 1000000007;
		int n = ni(), K = ni();
		int w1 = 0, w2 = 0;
		for(int i = 0;i < n;i++){
			if(ni() == 50){
				w1++;
			}else{
				w2++;
			}
		}

		long[][] C = new long[101][101];
		for(int i = 0;i <= 100;i++){
			C[i][0] = 1;
			for(int j = 1;j <= i;j++){
				C[i][j] = C[i-1][j] + C[i-1][j-1];
				if(C[i][j] >= mod)C[i][j] -= mod;
			}
		}

		int I = 99999999;
		int[][][] d = new int[w1+1][w2+1][2]; // [this50][this100][0:this,1:that]
		for(int i = 0;i <= w1;i++){
			for(int j = 0;j <= w2;j++){
				d[i][j][0] = d[i][j][1] = I;
			}
		}
		long[][][] dp = new long[w1+1][w2+1][2];
		dp[w1][w2][0] = 1L;
		d[w1][w2][0] = 0;
		Queue<int[]> q = new ArrayDeque<int[]>();
		q.add(new int[]{w1, w2, 0});
		while(!q.isEmpty()){
			int[] cur = q.poll();
			if(cur[2] == 0){
				int s1 = cur[0], s2 = cur[1];
				for(int j = 0;j <= s1;j++){
					for(int k = 0;k <= s2;k++){
						if(j+k == 0)continue;
						if(50*j+100*k>K)break;
						int ns1 = s1-j, ns2 = s2-k;
						if(d[ns1][ns2][1] == I){
							d[ns1][ns2][1] = d[s1][s2][0] + 1;
							dp[ns1][ns2][1] = dp[s1][s2][0] * C[s1][j] % mod * C[s2][k] % mod;
							q.add(new int[]{ns1, ns2, 1});
						}else if(d[ns1][ns2][1] == d[s1][s2][0] + 1){
							dp[ns1][ns2][1] = (dp[ns1][ns2][1] + dp[s1][s2][0]*C[s1][j]%mod*C[s2][k])%mod;
						}
					}
				}
			}else{
				int s1 = cur[0], s2 = cur[1];
				for(int j = 0;j <= w1-s1;j++){
					for(int k = 0;k <= w2-s2;k++){
						if(j+k == 0)continue;
						if(50*j+100*k>K)break;
						int ns1 = s1+j, ns2 = s2+k;
						if(d[ns1][ns2][0] == I){
							d[ns1][ns2][0] = d[s1][s2][1] + 1;
							dp[ns1][ns2][0] = dp[s1][s2][1] * C[w1-s1][j] % mod * C[w2-s2][k] % mod;
							q.add(new int[]{ns1, ns2, 0});
						}else if(d[ns1][ns2][0] == d[s1][s2][1] + 1){
							dp[ns1][ns2][0] = (dp[ns1][ns2][0] + dp[s1][s2][1]*C[w1-s1][j]%mod*C[w2-s2][k])%mod;
						}
					}
				}
			}
		}
		if(d[0][0][1] == I){
			out.println(-1);
			out.println(0);
		}else{
			out.println(d[0][0][1]);
			out.println(dp[0][0][1]);
		}
	}

	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 C().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)); }
}


import java.io.StreamTokenizer;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Reader;
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;
		TokenizerReader in = new TokenizerReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskE solver = new TaskE();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskE {
    final static long MOD = 1000000007;
    public void solve(@SuppressWarnings("UnusedParameters") int testNumber, TokenizerReader in, PrintWriter out) {
        int n = in.nextInt(), maxWeight = in.nextInt();
        long[][] C = new long[n+1][n+1];
        for (int i = 0; i <= n; ++i) {
            C[i][0] = C[i][i] = 1;
            for (int j = 1; j < i; ++j)
                C[i][j] = (C[i-1][j-1] + C[i-1][j]) % MOD;
        }
        maxWeight /= 50;
        int totalSmall = 0, totalBig = 0;
        for (int i = 0; i < n; ++i) {
            if (in.nextInt() == 50)
                ++totalSmall;
            else
                ++totalBig;
        }

        int[][][] time = new int[2][totalSmall + 1][totalBig + 1];
        for (int[][] ii: time)
            for (int[] i: ii)
                Arrays.fill(i, Integer.MAX_VALUE);
        for (int side = 0; side <= 1; ++side)
            for (int thisPeople = 0; thisPeople <= n; ++thisPeople)
                for (int thisSmall = Math.min(totalSmall, thisPeople); thisSmall >= 0; --thisSmall) {
                    int thisBig = thisPeople - thisSmall;
                    if (thisBig > totalBig)
                        continue;
                    int thatSmall = totalSmall - thisSmall;
                    int thatBig = totalBig - thisBig;
                    if (side == 1) {
                        if (thisPeople == n)
                            time[side][thisSmall][thisBig] = 0;
                        else if (thisSmall > 0)
                            time[side][thisSmall][thisBig] = 1 + time[0][thatSmall+1][thatBig];
                        else if (thisBig > 0)
                            time[side][thisSmall][thisBig] = 1 + time[0][thatSmall][thatBig+1];
                        continue;
                    }
                    if (thisPeople == 0)
                        continue;
                    for (int big = 0; big <= thisBig && 2*big <= maxWeight; ++big)
                        for (int small = 0; small <= thisSmall && 2*big+small <= maxWeight; ++small) {
                            if (big == thisBig && small == thisSmall)
                                time[side][thisSmall][thisBig] = 1;
                            else if (2*big + small > 1) {
                                int nextRightSmall = thatSmall + small;
                                int nextLeftBig, nextLeftSmall;
                                if (nextRightSmall > 0) {
                                    nextLeftBig = thisBig - big;
                                    nextLeftSmall = thisSmall + 1 - small;
                                } else {
                                    nextLeftBig = thisBig + 1 - big;
                                    nextLeftSmall = thisSmall - small;
                                }
                                if (nextLeftBig != thisBig || nextLeftSmall != thisSmall) {
                                    if (time[side][nextLeftSmall][nextLeftBig] < Integer.MAX_VALUE)
                                        time[side][thisSmall][thisBig] = Math.min(
                                                time[side][thisSmall][thisBig],
                                                time[side][nextLeftSmall][nextLeftBig] + 2
                                        );
                                }
                            }
                        }
                }

        int T = time[0][totalSmall][totalBig];
        if (T == Integer.MAX_VALUE) {
            out.println(-1);
            out.println(0);
            return;
        }
        long[][][] res = new long[2][totalSmall+1][totalBig+1];
        for (int t = 0; t <= T; ++t)
            for (int thisPeople = 0; thisPeople <= n; ++thisPeople)
                for (int thisSmall = 0; thisSmall <= totalSmall && thisSmall <= thisPeople; ++thisSmall) {
                    int thisBig = thisPeople - thisSmall;
                    if (thisBig > totalBig)
                        continue;
                    int side = 1 - t % 2;
                    if (time[side][thisSmall][thisBig] == 0) {
                        res[side][thisSmall][thisBig] = 1;
                        continue;
                    }
                    if (time[side][thisSmall][thisBig] != t)
                        continue;
                    for (int big = 0; big <= thisBig && 2*big <= maxWeight; ++big)
                        for (int small = 0; small <= thisSmall && 2*big + small <= maxWeight; ++small)
                            if (big + small > 0) {
                                int nextSmall = totalSmall - thisSmall + small;
                                int nextBig = totalBig - thisBig + big;
                                int nextSide = 1 - side;
                                if (time[nextSide][nextSmall][nextBig] == t-1) {
                                    long tmp = res[nextSide][nextSmall][nextBig] * C[thisBig][big] % MOD * C[thisSmall][small] % MOD;
                                    res[side][thisSmall][thisBig] += tmp;
                                    res[side][thisSmall][thisBig] %= MOD;
                                }
                            }
                }

        out.println(T);
        out.println(res[0][totalSmall][totalBig]);
    }
}

class TokenizerReader extends StreamTokenizer {
    public TokenizerReader(InputStream in) {
        super(new BufferedReader(new InputStreamReader(in)));
        defaultConfig();
    }

    public String nextString() {
        try {
            nextToken();
        } catch (IOException e) {
            throw new RuntimeException("nextString: exception in line " + lineno(), e);
        }
        return sval;
    }

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

    public void defaultConfig() {
        resetSyntax();
        wordChars(33, 126);
        whitespaceChars(0, ' ');
    }

    }


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

public class C {
	static int n, k, f, h;

	public static void main(String[] args) throws IOException {
		InputReader in = new InputReader();
		n = in.nextInt();
		k = in.nextInt();
		for (int i = 0; i < n; i++) {
			int w = in.nextInt();
			if (w == 100)
				h++;
			else
				f++;
		}
		nCr(55, 55);
		dp1 = new int[55][55];
		for (int i = 0; i < 55; i++)
			Arrays.fill(dp1[i], -1);
		dp2 = new long[55][55][202];
		for (int i = 0; i < 55; i++)
			for (int j = 0; j < 55; j++)
				Arrays.fill(dp2[i][j], -1);
		r1 = getMin(f, h);
		if (r1 >= 1 << 25) {
			System.out.println(-1);
			System.out.println(0);
		} else {
			long r2 = go(f, h, 0);
			System.out.println(r1);
			System.out.println(r2);
		}
	}

	static int r1;

	public static long go(int x, int y, int t) {
		if (x == f && y == h && t == r1)
			return 1;
		if(t>=r1)return 0;
		int side = t % 2;
		if (dp2[x][y][t] != -1)
			return dp2[x][y][t];
		long ret = 0;
		for (int i = 0; i <= x && i * 50 <= k; i++) {
			for (int j = 0; j <= y && i * 50 + j * 100 <= k; j++) {
				if (i + j == 0 || (i == x && j == y && side == 1))
					continue;
				ret = (ret+((go(f-x+i, h-y+j, t+1)*c[x][i])%mod)*c[y][j])%mod;
			}
		}
		return dp2[x][y][t] = ret;
	}

	static long[][][] dp2;
	static int[][] dp1;
	static int mod = 1000000007;

	public static int getMin(int x, int y) {
		if (x == 0 && y == 0)
			return 0;
		if (dp1[x][y] != -1)
			return dp1[x][y];
		int ret = 1 << 25;
		for (int i = 0; i <= x && i * 50 <= k; i++) {
			for (int j = 0; j <= y && i * 50 + j * 100 <= k; j++) {
				if (i + j == 0)
					continue;
				if (i == x && j == y) {
					ret = 1;
				} else {
					if (i != 0 && j != 0) {
						ret = Math.min(
								ret,
								2 + Math.min(getMin(x - i + 1, y - j),
										getMin(x - i, y - j + 1)));
					} else if (i > 1 && j == 0) {
						ret = Math.min(ret, 2 + getMin(x - i + 1, y));
					} else if (i == 0) {
						if (j > 1) {
							ret = Math.min(2+getMin(x - i, y - j + 1), ret);
						}
						if (f - x >= 1) {
							ret = Math.min(2+getMin(x + 1, y - j), ret);
						}
					}
				}
			}
		}
		return dp1[x][y] = ret;
	}

	static long[][] c;

	public static void nCr(int n, int r) {
		c = new long[n + 1][r + 1];
		for (int i = 0; i < n + 1; i++)
			c[i][0] = 1;

		for (int j = 1; j <= r; j++)
			for (int i = j; i <= n; i++)
				c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % mod;
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer st;

		public InputReader() throws IOException {
			in = new BufferedReader(new InputStreamReader(System.in));
			st = new StringTokenizer(in.readLine());
		}

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

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

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


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

public class CF1206F extends PrintWriter {
	CF1206F() { super(System.out); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		CF1206F o = new CF1206F(); o.main(); o.flush();
	}

	int[] next, jj; int l_ = 1;
	int link(int l, int j) { next[l_] = l; jj[l_] = j; return l_++; }
	int[] ao; int n;
	int[] cc;
	void init() {
		int m = n - 1;
		next = new int[1 + m * 2];
		jj = new int[1 + m * 2];
		ao = new int[n];
		cc = new int[n];
	}
	int n_, i_, j_;
	int dfs(int p, int i) {
		int k = 1;
		for (int l = ao[i]; l != 0; l = next[l]) {
			int j = jj[l];
			if (j != p)
				k += dfs(i, j);
		}
		int k_ = Math.min(k, n - k);
		if (n_ < k_) {
			n_ = k_;
			if (k <= n - k) {
				i_ = i;
				j_ = p;
			} else {
				i_ = p;
				j_ = i;
			}
		}
		cc[i] = k;
		return k;
	}
	int a, b;
	void dfs_(int p, int i, int c, boolean print) {
		if (print) {
			a += b;
			println((p + 1) + " " + (i + 1) + " " + (a - c));
			c = a;
		}
		for (int l = ao[i]; l != 0; l = next[l]) {
			int j = jj[l];
			if (j != p)
				dfs_(i, j, c, true);
		}
	}
	void main() {
		n = sc.nextInt();
		if (n == 1)
			return;
		init();
		for (int h = 0; h < n - 1; h++) {
			int i = sc.nextInt() - 1;
			int j = sc.nextInt() - 1;
			ao[i] = link(ao[i], j);
			ao[j] = link(ao[j], i);
		}
		dfs(-1, 0);
		if (n_ * 3 >= n) {
			b = 1;
			a = 0;
			dfs_(i_, j_, 0, false);
			b = n - n_;
			a = 0;
			dfs_(j_, i_, 0, true);
		} else {
			int s = j_;
			dfs(-1, s);
			Integer[] tt = new Integer[n];
			int cnt = 0;
			for (int l = ao[s]; l != 0; l = next[l])
				tt[cnt++] = jj[l];
			Arrays.sort(tt, 0, cnt, (i, j) -> cc[i] - cc[j]);
			n_ = 1;
			b = 1;
			a = 0;
			boolean changed = false;
			for (int h = 0; h < cnt; h++) {
				int j = tt[h];
				n_ += cc[j];
				dfs_(s, j, 0, true);
				if (!changed && n_ * 3 >= n) {
					changed = true;
					b = n_;
					a = 0;
				}
			}
		}
	}
}


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

public class MainF {
	static final StdIn in = new StdIn();
	static final PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		int n=in.nextInt(), m=in.nextInt();
		int[] a = in.readIntArray(n, -1), b = in.readIntArray(m, 0);
		int sb=0;
		for(int bi : b)
			sb+=bi;
		int[] c = new int[m];
		int cl=m;
		for(int bi : b)
			if(bi==0)
				--cl;
		int i1=0;
		while(cl>0&&i1<n) {
			++c[a[i1]];
			if(c[a[i1]]==b[a[i1]])
				--cl;
			++i1;
		}
		int ans=n+1;
		if(cl==0) {
			for(int i2=0; ;) {
				while(c[a[i2]]>b[a[i2]])
					--c[a[i2++]];
				ans=Math.min(i1-i2-sb, ans);
				if(i1>=n)
					break;
				++c[a[i1++]];
			}
		}
		//E
		out.println(ans==0?"YES":"NO");
		//M
//		out.println(ans>n?-1:ans);
		out.close();
	}

	static class StdIn {
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte[] buffer;
		private int bufferPointer, bytesRead;
		public StdIn() {
			din = new DataInputStream(System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}
		public StdIn(InputStream in) {
			try{
				din = new DataInputStream(in);
			} catch(Exception e) {
				throw new RuntimeException();
			}
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}
		public String next() {
			int c;
			while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));
			StringBuilder s = new StringBuilder();
			while (c != -1)
			{
				if (c == ' ' || c == '\n'||c=='\r')
					break;
				s.append((char)c);
				c=read();
			}
			return s.toString();
		}
		public String nextLine() {
			int c;
			while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));
			StringBuilder s = new StringBuilder();
			while (c != -1)
			{
				if (c == '\n'||c=='\r')
					break;
				s.append((char)c);
				c = read();
			}
			return s.toString();
		}
		public int nextInt() {
			int ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');

			if (neg)
				return -ret;
			return ret;
		}
		public int[] readIntArray(int n, int os) {
			int[] ar = new int[n];
			for(int i=0; i<n; ++i)
				ar[i]=nextInt()+os;
			return ar;
		}
		public long nextLong() {
			long ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}
		public long[] readLongArray(int n, long os) {
			long[] ar = new long[n];
			for(int i=0; i<n; ++i)
				ar[i]=nextLong()+os;
			return ar;
		}
		public double nextDouble() {
			double ret = 0, div = 1;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');
			if (c == '.')
				while ((c = read()) >= '0' && c <= '9')
					ret += (c - '0') / (div *= 10);
			if (neg)
				return -ret;
			return ret;
		}
		private void fillBuffer() throws IOException {
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}
		private byte read() {
			try{
				if (bufferPointer == bytesRead)
					fillBuffer();
				return buffer[bufferPointer++];
			} catch(IOException e) {
				throw new RuntimeException();
			}
		}
		public void close() throws IOException {
			if (din == null)
				return;
			din.close();
		}
	}
}


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

public class TaskB
{
	public static void main(String[] args)
	{
		new TaskB(System.in, System.out);
	}

	static class Solver implements Runnable
	{
		int n, b;
		int[] arr;
		InputReader in;
		PrintWriter out;

		void solve() throws IOException
		{
			n = in.nextInt();
			b = in.nextInt();
			arr = in.nextIntArray(n);

			PriorityQueue<Integer> set = new PriorityQueue<>(Integer::compareTo);
			int odd = 0;
			int even = 0;

			for (int i = 0; i < n; i++)
			{
				if (arr[i] % 2 == 0)
					even++;
				else
					odd++;

				if (i < n - 1 && even == odd)
					set.add(Math.abs(arr[i] - arr[i + 1]));
			}

			int cnt = 0;

			while (set.size() > 0)
			{
				int x = set.poll();

				if (x <= b)
				{
					cnt++;
					b -= x;
				}
				else
					break;
			}

			out.println(cnt);
		}

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

//		uncomment below line to change to BufferedReader
//		public Solver(BufferedReader in, PrintWriter out)
		public Solver(InputReader in, PrintWriter out)
		{
			this.in = in;
			this.out = out;
		}

		@Override
		public void run()
		{
			try
			{
				solve();
			}
			catch (IOException e)
			{
				e.printStackTrace();
			}
		}

	}

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

		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 & 15;

				c = read();
			} while (!isSpaceChar(c));

			return res * sgn;
		}

		public int[] nextIntArray(int arraySize)
		{
			int array[] = new int[arraySize];

			for (int i = 0; i < arraySize; i++)
				array[i] = nextInt();

			return array;
		}

		public long nextLong()
		{
			int c = read();

			while (isSpaceChar(c))
				c = read();

			int sign = 1;

			if (c == '-')
			{
				sign = -1;

				c = read();
			}

			long result = 0;

			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();

				result *= 10;
				result += c & 15;

				c = read();
			} while (!isSpaceChar(c));

			return result * sign;
		}

		public long[] nextLongArray(int arraySize)
		{
			long array[] = new long[arraySize];

			for (int i = 0; i < arraySize; i++)
				array[i] = nextLong();

			return array;
		}

		public float nextFloat()
		{
			float result, div;
			byte c;

			result = 0;
			div = 1;
			c = (byte) read();

			while (c <= ' ')
				c = (byte) read();

			boolean isNegative = (c == '-');

			if (isNegative)
				c = (byte) read();

			do
			{
				result = result * 10 + c - '0';
			} while ((c = (byte) read()) >= '0' && c <= '9');

			if (c == '.')
				while ((c = (byte) read()) >= '0' && c <= '9')
					result += (c - '0') / (div *= 10);

			if (isNegative)
				return -result;

			return result;
		}

		public double nextDouble()
		{
			double ret = 0, div = 1;
			byte c = (byte) read();

			while (c <= ' ')
				c = (byte) read();

			boolean neg = (c == '-');

			if (neg)
				c = (byte) read();

			do
			{
				ret = ret * 10 + c - '0';
			} while ((c = (byte) read()) >= '0' && c <= '9');

			if (c == '.')
				while ((c = (byte) read()) >= '0' && c <= '9')
					ret += (c - '0') / (div *= 10);

			if (neg)
				return -ret;

			return ret;
		}

		public String next()
		{
			int c = read();

			while (isSpaceChar(c))
				c = read();

			StringBuilder res = new StringBuilder();

			do
			{
				res.appendCodePoint(c);

				c = read();
			} while (!isSpaceChar(c));

			return res.toString();
		}

		public String nextLine()
		{
			int c = read();

			StringBuilder result = new StringBuilder();

			do
			{
				result.appendCodePoint(c);

				c = read();
			} while (!isNewLine(c));

			return result.toString();
		}

		public boolean isNewLine(int c)
		{
			return c == '\n';
		}

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

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

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

	}

	static class CMath
	{
		static long power(long number, long power)
		{
			if (number == 1 || number == 0 || power == 0)
				return 1;

			if (power == 1)
				return number;

			if (power % 2 == 0)
				return power(number * number, power / 2);
			else
				return power(number * number, power / 2) * number;
		}

		static long modPower(long number, long power, long mod)
		{
			if (number == 1 || number == 0 || power == 0)
				return 1;

			number = mod(number, mod);

			if (power == 1)
				return number;

			long square = mod(number * number, mod);

			if (power % 2 == 0)
				return modPower(square, power / 2, mod);
			else
				return mod(modPower(square, power / 2, mod) * number, mod);
		}

		static long moduloInverse(long number, long mod)
		{
			return modPower(number, mod - 2, mod);
		}

		static long mod(long number, long mod)
		{
			return number - (number / mod) * mod;
		}

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

		static long min(long... arr)
		{
			long min = arr[0];

			for (int i = 1; i < arr.length; i++)
				min = Math.min(min, arr[i]);

			return min;
		}

		static long max(long... arr)
		{
			long max = arr[0];

			for (int i = 1; i < arr.length; i++)
				max = Math.max(max, arr[i]);

			return max;
		}

		static int min(int... arr)
		{
			int min = arr[0];

			for (int i = 1; i < arr.length; i++)
				min = Math.min(min, arr[i]);

			return min;
		}

		static int max(int... arr)
		{
			int max = arr[0];

			for (int i = 1; i < arr.length; i++)
				max = Math.max(max, arr[i]);

			return max;
		}

	}

	static class Utils
	{
		static boolean nextPermutation(int[] arr)
		{
			for (int a = arr.length - 2; a >= 0; --a)
			{
				if (arr[a] < arr[a + 1])
				{
					for (int b = arr.length - 1; ; --b)
					{
						if (arr[b] > arr[a])
						{
							int t = arr[a];

							arr[a] = arr[b];
							arr[b] = t;

							for (++a, b = arr.length - 1; a < b; ++a, --b)
							{
								t = arr[a];
								arr[a] = arr[b];
								arr[b] = t;
							}

							return true;
						}
					}
				}
			}

			return false;
		}

	}

	public TaskB(InputStream inputStream, OutputStream outputStream)
	{
//		uncomment below line to change to BufferedReader
//		BufferedReader in = new BufferedReader(new InputStreamReader(inputStream));
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Thread thread = new Thread(null, new Solver(in, out), "TaskB", 1 << 29);

		try
		{
			thread.start();
			thread.join();
		}
		catch (InterruptedException e)
		{
			e.printStackTrace();
		}
		finally
		{
			in.close();
			out.flush();
			out.close();
		}
	}

}

/*

*/


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.stream.Stream;

public class TestClass implements Runnable {

	static final double time = 1e9;
	static final int MOD = (int) 1e9 + 7;
	static final long mh = Long.MAX_VALUE;
	static final Reader in = new Reader();
	static final PrintWriter out = new PrintWriter(System.out);
	StringBuilder answer = new StringBuilder();

	public static void main(String[] args) {
		new Thread(null, new TestClass(), "persefone", 1 << 28).start();
	}

	@Override
	public void run() {
		long start = System.nanoTime();
		solve();
		printf();
		long elapsed = System.nanoTime() - start;
//		out.println("stamp : " + elapsed / time);
//		out.println("stamp : " + TimeUnit.SECONDS.convert(elapsed, TimeUnit.NANOSECONDS));
		close();
	}

	void solve() {
		int n = in.nextInt(), x = in.nextInt();
		int[] a = new int[n + 1];
		for (int i = 1; i <= n; i++) a[i] = in.nextInt();
		a[0] = a[1];
		int[][] f = new int[n + 1][x + 1];

		for (int i = 2; i <= n; i += 2) {
			int even = a[i] % 2 == 0 ? 1 : 0;
			for (int j = i - 1; j > 1; j--) {
				if (a[j] % 2 == 0) even++;
				if (even * 2 == i - j + 1) {
					int d = Math.abs(a[j] - a[j - 1]);
					for (int k = 0; k <= x; k++)
						if (d <= k)
							f[i][k] = Math.max(f[j - 1][k - d] + 1, f[i][k]);
				}
			}
		}
//		printf(f);
		printf(f[n][x]);
  	}

	public interface Hash {
		public void computeHashArray();
		public void computeModArray();

	}

	class StringHash implements Hash {
		// length of string s
		private final long MH = Long.MAX_VALUE;
		private int n;
		private char[] ch;
		private long[] hash, mod;
		StringHash(char[] ch) {
			this.ch = ch;
			n = ch.length;
			hash = new long[n + 1];
			mod = new long[n + 1];
			computeHashArray();
			computeModArray();
		}

		StringHash(String s) {
			this(s.toCharArray());
		}

		StringHash(CharSequence s) {
			this(s.toString());
		}

		@Override
		public void computeModArray() {
			mod[0] = 1;
			for (int i = 1; i <= n; i++) mod[i] = (mod[i - 1] * 53) % MH;
		}

		@Override
		public void computeHashArray() {
			for (int i = 0; i < n; i++) hash[i + 1] = (hash[i] * 53 + ch[i] - 'a') % MH;
		}

		public long getHash(int i, int j) {
			return (hash[j] - hash[i] * mod[j - i] + MH * MH) % MH;
		}

		public long getHash(String s) {
			long h = 0;
			for (int i = 0; i < s.length(); i++) h = (h * 53 + s.charAt(i) - 'a') % MH;
			return h;
		}

		public long[] getHashArray() { return hash; }
		public long[] getModArray() { return mod; }
	}

	public interface Manacher {
		public void oddPalindrome();
		public void evenPalindrome();
	}

	class Palindrome implements Manacher {
		private int n;
		private char[] ch;
		private int[] oddPal, evenPal;
		public Palindrome() {}
		public Palindrome(String s) {
			this(s.toCharArray());
		}
		public Palindrome(char[] ch) {
			this.ch = ch;
			n = ch.length;
			oddPal = new int[ch.length];
			evenPal = new int[ch.length];
			oddPalindrome();
			evenPalindrome();
		}

		@Override
		public void oddPalindrome() {
			for (int i = 0, l = 0, r = -1; i < n; i++) {
				int k = i > r ? 1 : Math.min(oddPal[r + l - i], r - i);
				while (0 <= i - k && i + k < n && ch[i - k] == ch[i + k]) k++;
				oddPal[i] = k--;
				if (i + k > r) {
					l = i - k;
					r = i + k;
				}
			}
		}
		@Override
		public void evenPalindrome() {
			for (int i = 0, l = 0, r = -1; i < n; i++) {
				int k = i > r ? 0 : Math.min(evenPal[r + l - i + 1], r - i + 1);
				while (0 <= i - k - 1 && i + k < n && ch[i - k - 1] == ch[i + k]) k++;
				evenPal[i] = k--;
				if (i + k > r) {
					l = i - k - 1;
					r = i + k;
				}
			}
		}
	}

	void printf() {
		out.print(answer);
	}

	void close() {
		out.close();
	}

	void printf(Stream<?> str) {
		str.forEach(o -> add(o, " "));
		add("\n");
	}

	void printf(Object... obj) {
		printf(false, obj);
	}

	void printfWithDescription(Object... obj) {
		printf(true, obj);
	}

	private void printf(boolean b, Object... obj) {

		if (obj.length > 1) {
			for (int i = 0; i < obj.length; i++) {
				if (b) add(obj[i].getClass().getSimpleName(), " - ");
				if (obj[i] instanceof Collection<?>) {
					printf((Collection<?>) obj[i]);
				} else if (obj[i] instanceof int[][]) {
					printf((int[][])obj[i]);
				} else if (obj[i] instanceof long[][]) {
					printf((long[][])obj[i]);
				} else if (obj[i] instanceof double[][]) {
					printf((double[][])obj[i]);
				} else printf(obj[i]);
			}
			return;
		}

		if (b) add(obj[0].getClass().getSimpleName(), " - ");
		printf(obj[0]);
	}

	void printf(Object o) {
		if (o instanceof int[])
			printf(Arrays.stream((int[]) o).boxed());
		else if (o instanceof char[])
			printf(new String((char[]) o));
		else if (o instanceof long[])
			printf(Arrays.stream((long[]) o).boxed());
		else if (o instanceof double[])
			printf(Arrays.stream((double[]) o).boxed());
		else if (o instanceof boolean[]) {
			for (boolean b : (boolean[]) o) add(b, " ");
			add("\n");
		}
		else
			add(o, "\n");
	}

	void printf(int[]... obj) {
		for (int i = 0; i < obj.length; i++) printf(obj[i]);
	}

	void printf(long[]... obj) {
		for (int i = 0; i < obj.length; i++) printf(obj[i]);
	}

	void printf(double[]... obj) {
		for (int i = 0; i < obj.length; i++) printf(obj[i]);
	}

	void printf(boolean[]... obj) {
		for (int i = 0; i < obj.length; i++) printf(obj[i]);
	}

	void printf(Collection<?> col) {
		printf(col.stream());
	}

	<T, K> void add(T t, K k) {
		if (t instanceof Collection<?>) {
			((Collection<?>) t).forEach(i -> add(i, " "));
		} else if (t instanceof Object[]) {
			Arrays.stream((Object[]) t).forEach(i -> add(i, " "));
		} else
			add(t);
		add(k);
	}

	<T> void add(T t) {
		answer.append(t);
	}

	@SuppressWarnings("unchecked")
	<T extends Comparable<? super T>> T min(T... t) {
		if (t.length == 0)
			return null;
		T m = t[0];
		for (int i = 1; i < t.length; i++)
			if (t[i].compareTo(m) < 0)
				m = t[i];
		return m;
	}

	@SuppressWarnings("unchecked")
	<T extends Comparable<? super T>> T max(T... t) {
		if (t.length == 0)
			return null;
		T m = t[0];
		for (int i = 1; i < t.length; i++)
			if (t[i].compareTo(m) > 0)
				m = t[i];
		return m;
	}

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

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

	// c = gcd(a, b) -> extends gcd method: ax + by = c <----> (b % a)p + q = c;
	int[] ext_gcd(int a, int b) {
		if (b == 0) return new int[] {a, 1, 0 };
		int[] vals = ext_gcd(b, a % b);
		int d = vals[0]; // gcd
	    int p = vals[2]; //
		int q = vals[1] - (a / b) * vals[2];
		return new int[] { d, p, q };
	}

	// find any solution of the equation: ax + by = c using extends gcd
	boolean find_any_solution(int a, int b, int c, int[] root) {
		int[] vals = ext_gcd(Math.abs(a), Math.abs(b));
		if (c % vals[0] != 0) return false;
		printf(vals);
		root[0] = c * vals[1] / vals[0];
		root[1] = c * vals[2] / vals[0];
		if (a < 0) root[0] *= -1;
		if (b < 0) root[1] *= -1;
		return true;
	}

	int mod(int x) { return x % MOD; }

	int mod(int x, int y) { return mod(mod(x) + mod(y)); }

	long mod(long x) { return x % MOD; }

	long mod (long x, long y) { return mod(mod(x) + mod(y)); }

	int lw(long[] f, int l, int r, long k) {
		int R = r, m = 0;
		while (l <= r) {
			m = l + r >> 1;
		    if (m == R) return m;
		    if (f[m] >= k) r = m - 1; else l = m + 1;
		}
		return l;
	}

	int up(long[] f, int l, int r, long k) {
		int R = r, m = 0;
		while (l <= r) {
			m = l + r >> 1;
		    if (m == R) return m;
		    if (f[m] > k) r = m - 1; else l = m + 1;
		}
		return l;
	}

	int lw(int[] f, int l, int r, int k) {
//		int R = r, m = 0;
		while (l <= r) {
			int m = l + r >> 1;
//		    if (m == R) return m;
		    if (f[m] >= k) r = m - 1; else l = m + 1;
		}
		return l;
	}

	int up(int[] f, int l, int r, int k) {
		int R = r, m = 0;
		while (l <= r) {
			m = l + r >> 1;
		    if (m == R) return m;
		    if (f[m] > k) r = m - 1; else l = m + 1;
		}
		return l;
	}

	long calc(int base, int exponent) {
		if (exponent == 0) return 1;
		long m = calc(base, exponent >> 1);
		if (exponent % 2 == 0) return m * m % MOD;
		return base * m * m % MOD;
	}

	long power(int base, int exponent) {
		if (exponent == 0) return 1;
		long m = power(base, exponent >> 1);
		if (exponent % 2 == 0) return m * m;
		return base * m * m;
	}

	void swap(int[] a, int i, int j) {
		a[i] ^= a[j];
		a[j] ^= a[i];
		a[i] ^= a[j];
	}

	void swap(long[] a, int i, int j) {
		long tmp = a[i];
		a[i] = a[j];
		a[j] = tmp;
	}

	static class Pair<K extends Comparable<? super K>, V extends Comparable<? super V>>
			implements Comparable<Pair<K, V>> {
		private K k;
		private V v;

		Pair() {}

		Pair(K k, V v) {
			this.k = k;
			this.v = v;
		}

		K getK() { return k; }

		V getV() { return v; }

		void setK(K k) { this.k = k; }

		void setV(V v) { this.v = v; }

		void setKV(K k, V v) {
			this.k = k;
			this.v = v;
		}

		@SuppressWarnings("unchecked")
		@Override
		public boolean equals(Object o) {
			if (this == o) return true;
			if (o == null || !(o instanceof Pair)) return false;
			Pair<K, V> p = (Pair<K, V>) o;
			return k.compareTo(p.k) == 0 && v.compareTo(p.v) == 0;
		}

		@Override
		public int hashCode() {
			int hash = 31;
			hash = hash * 89 + k.hashCode();
			hash = hash * 89 + v.hashCode();
			return hash;
		}

		@Override
		public int compareTo(Pair<K, V> pair) {
			return k.compareTo(pair.k) == 0 ? v.compareTo(pair.v) : k.compareTo(pair.k);
		}

		@Override
		public Pair<K, V> clone() {
			return new Pair<K, V>(this.k, this.v);
		}

		@Override
		public String toString() {
			return String.valueOf(k).concat(" ").concat(String.valueOf(v)).concat("\n");
		}
	}

	static class Reader {
		private BufferedReader br;
		private StringTokenizer st;

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

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

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

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

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

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


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

public class Solution
{
    static class InputReader
	{
	    private final InputStream stream;
	    private final byte[] buf = new byte[8192];
	    private int curChar, snumChars;

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

	    public int read() {
	      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 = read();
	      while (isSpaceChar(c)) {
	        c = read();
	      }
	      int sgn = 1;
	      if (c == '-') {
	        sgn = -1;
	        c = read();
	      }
	      int res = 0;
	      do {
	        res *= 10;
	        res += c - '0';
	        c = read();
	      } while (!isSpaceChar(c));
	      return res * sgn;
	    }

	    public long nextLong() {
	      int c = read();
	      while (isSpaceChar(c)) {
	        c = read();
	      }
	      int sgn = 1;
	      if (c == '-') {
	        sgn = -1;
	        c = read();
	      }
	      long res = 0;
	      do {
	        res *= 10;
	        res += c - '0';
	        c = read();
	      } 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 String readString() {
	      int c = read();
	      while (isSpaceChar(c)) {
	        c = read();
	      }
	      StringBuilder res = new StringBuilder();
	      do {
	        res.appendCodePoint(c);
	        c = read();
	      } while (!isSpaceChar(c));
	      return res.toString();
	    }

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

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

	    private boolean isEndOfLine(int c) {
	      return c == '\n' || c == '\r' || c == -1;
	    }
	}
    /*static class node implements Comparable<node>
    {
        int index;
        int val;
        node(int a1,int a2)
        {
            index=a1;
            val=a2;
        }
        public int compareTo(node n1)
        {
            return(this.val-n1.val);
        }
    }*/
    public static void main(String[] args) throws IOException
    {
        InputReader in=new InputReader(System.in);
        int n=in.nextInt();
        int b=in.nextInt();
        int [] a=new int[n];
        a=in.nextIntArray(n);
        int[] odd=new int[n+1];
        int[] even=new int[n+1];
        odd[0]=0;
        even[0]=0;
        for(int i=1;i<=n;i++)
        {
            if(a[i-1]%2==1)
            {
                odd[i]=odd[i-1]+1;
                even[i]=even[i-1];
            }
            else
            {
                odd[i]=odd[i-1];
                even[i]=even[i-1]+1;
            }
        }
        int prev=0;
        PriorityQueue<Integer> cost=new PriorityQueue<Integer>();
        for(int i=1;i<=n-1;i++)
        {
            int oc=odd[i]-odd[prev];
            int ec=even[i]-even[prev];
            if(oc==ec)
            {
                cost.add((int)Math.abs(a[i]-a[i-1]));
                //System.out.println((int)Math.abs(a[i]-a[i-1]));
                prev=i;
            }
        }
        int sum=0;
        int count=0;
        while(!cost.isEmpty() && sum<=b)
        {
            sum+=cost.peek().intValue();
            cost.poll();
            count++;
        }
        if(count==0)
        {
            System.out.println("0");
        }
        else
        {
            if(cost.isEmpty() && sum<=b)
            {
                System.out.println(count);
            }
            else
            {
                System.out.println(count-1);
            }
        }
    }
}


//  package codeforces;

/**
 * Created by sky on 1/7/18.
 * www.github.com/aakashjaiswal1
 * aakashjaiswal@hotmail.co.in
 * aakashjaiswal.in@gmail.com
 * people die if they are killed
 */
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

/**
 * Created by sky on 13/4/18.
 * www.github.com/aakashjaiswal1
 * aakashjaiswal@hotmail.co.in
 * aakashjaiswal.in@gmail.com
 * people die if they are killed
 */
 public class default_t {

    public static void main(String[] args) {
        in = new FastReader();
        int n=ni();
        int B=ni();
        int[] arr=takeIntegerArrayInput(n);
        PriorityQueue<Integer> pq=new PriorityQueue<>();
        int e=0;
        int o=0;
        for (int i=0;i<n-1;i++){
            int ele=arr[i];
            if (ele%2==0)e++;
            else o++;
            if (e==o){
                pq.add(Math.abs(arr[i]-arr[i+1]));
            }
        }
        long ans=0;
        while (B>=0&&pq.size()>0){
            B-=pq.poll();
            if (B<0)break;
            ans++;
        }
        System.out.println(ans);

    }
    public static long binarySearch(long low, long high) {
        while (high - low > 1) {
            long mid = (high - low)/2 + low;
            //System.out.println(mid);
            if (works(mid)) {
                high = mid;
            } else {
                low = mid;
            }
        }
        return (works(low) ? low : high);
    }
    static private boolean works(long test){
        return true;
    }

    static void reverse(char[] arr ,int i,int j){
        if (i==j)
            return;
        while (i<j){
            char temp=arr[i];
            arr[i]=arr[j];
            arr[j]=temp;
            ++i;
            --j;
        }
    }
    static int[]  takeIntegerArrayInput(int no){
        int[] arr=new int[no];
        for (int i=0;i<no;++i){
            arr[i]=ni();
        }
        return arr;
    }
    static long fast_Multiply(long no , long pow){
        long result=1;
        while (pow>0){
            if ((pow&1)==1){
                result=result*no;
            }
            no=no*no;
            pow>>=1;
        }
        return result;
    }

    static long[]  takeLongArrayInput(int no){
        long[] arr=new long[no];
        for (int i=0;i<no;++i){
            arr[i]=ni();
        }
        return arr;
    }
    static final long MOD = (long)1e9+7;
    static FastReader in;

    static void p(Object o){
        System.out.print(o);
    }

    static void pn(Object o){
        System.out.println(o);
    }

    static String n(){
        return in.next();
    }

    static String nln(){
        return in.nextLine();
    }

    static int ni(){
        return Integer.parseInt(in.next());
    }

    static int[] ia(int N){
        int[] a = new int[N];
        for(int i = 0; i<N; i++)a[i] = ni();
        return a;
    }

    static long[] la(int N){
        long[] a = new long[N];
        for(int i = 0; i<N; i++)a[i] = nl();
        return a;
    }

    static long nl(){
        return Long.parseLong(in.next());
    }

    static double nd(){
        return Double.parseDouble(in.next());
    }

    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();
        }

        String nextLine(){
            String str = "";
            try{
                str = br.readLine();
            }catch (IOException e){
                e.printStackTrace();
            }
            return str;
        }
    }
    static void println(String[] arr){
        for (int i=0;i<arr.length;++i){
            System.out.println(arr[i]);
        }
    }

}


//package math_codet;

import java.io.InputStream;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.*;
 /******************************************
*    AUTHOR:         AMAN KUMAR SINGH        *
*    INSTITUITION:   KALYANI GOVERNMENT ENGINEERING COLLEGE  *
******************************************/
public class lets_do {
    public static void main(String[] args) throws java.lang.Exception{
        InputReader in=new InputReader(System.in);
        StringBuffer str=new StringBuffer();
        int n=in.nextInt();
        int b=in.nextInt();
        int[] arr1=new int[n];
        int i=0;
        for(i=0;i<n;i++){
            arr1[i]=in.nextInt();
        }
        int odd=0,even=0;
        int[] pf1=new int[n];
        int[] pf2=new int[n];
        int sum1=0,sum2=0;
        for(i=0;i<n;i++){
            if(arr1[i]%2==0)
                sum1++;
            else
                sum2++;
            pf1[i]=sum1;
            pf2[i]=sum2;
        }
        int prev=0;
        int[] arr=new int[n];
        int p=0;
        for(i=1;i<n-2;i+=2){
            int x,y;
            if(prev==0){
                x=pf1[i];
                y=pf2[i];
            }
            else{
                x=pf1[i]-pf1[prev];
                y=pf2[i]-pf2[prev];
            }
            if(x==y){
                arr[p]=Math.abs(arr1[i+1]-arr1[i]);
                p++;
            }
        }

        int[] val=new int[p];
        for(i=0;i<p;i++)
            val[i]=1;
        int K[][] = new int[p+1][b+1];
        for (i = 0; i <= p; i++)
        {
            for (int w = 0; w <= b; w++)
            {
                if (i==0 || w==0)
                    K[i][w] = 0;
                else if (arr[i-1] <= w)
                    K[i][w] = Math.max(val[i-1] + K[i-1][w-arr[i-1]],  K[i-1][w]);
                else
                    K[i][w] = K[i-1][w];
            }
        }
        System.out.println(K[p][b]);
    }

    static class InputReader{
        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 UnknownError();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new UnknownError();
                }
                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 void skip(int x) {
            while (x-- > 0)
                read();
        }

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

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

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

        public String next() {
            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 String nextLine() {
            StringBuffer buf = new StringBuffer();
            int c = read();
            while (c != '\n' && c != -1) {
                if (c != '\r')
                    buf.appendCodePoint(c);
                c = read();
            }
            return buf.toString();
        }

        public double nextDouble() {
            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, nextInt());
                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, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

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

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


import java.util.*;

public class Main {
	static int p=0,ip=0;
	static ArrayList<Integer> cuts=new ArrayList<>();
	public static void main(String args[]) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int b=sc.nextInt();
		int tab[]=new int[n];
		for(int i=0;i<n;i++) {
			tab[i]=sc.nextInt();
			if(tab[i]%2==0) p++;
			else ip++;
		}
		if(p!=ip) System.out.println(0);
		else {
			cut(tab);
			Collections.sort(cuts);
			int res=0;
			int count=0;
			for(int i=0;i<cuts.size();i++) {
				if(res+cuts.get(i)<=b) {
					res+=cuts.get(i);
					count++;
				}
				else break;
			}
			System.out.println(count);
		}
	}
	public static void cut(int tab[]) {
		int res=0;
		int pp=0;
		int iip=0;
		int min=1000;
		for(int i=0;i<tab.length-1;i++) {
			if(tab[i]%2==0) pp++;
			else iip++;
			if(pp==iip) {
				cuts.add(Math.abs(tab[i+1]-tab[i]));
			}
		}
	}
}


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

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

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

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

        int[] oddCount = new int[n];
        int[] evenCount = new int[n];
        if (a[0] % 2 == 0) {
            evenCount[0] = 1;
        }
        else {
            oddCount[0] = 1;
        }

        for (int i = 1; i < n; i ++) {
            if (a[i] % 2 == 0) {
                evenCount[i] = evenCount[i - 1] + 1;
                oddCount[i] = oddCount[i - 1];
            }
            else {
                oddCount[i] = oddCount[i - 1] + 1;
                evenCount[i] = evenCount[i - 1];
            }
        }

        ArrayList <Integer> costs = new ArrayList<Integer>();
        for (int i = 0; i < n - 1; i ++) {
            if (evenCount[i] == oddCount[i]) {
                costs.add(Math.abs(a[i] - a[i + 1]));
            }
        }
        Collections.sort(costs);
        int used = 0, maxCuts = 0;
        for (int i = 0; i < costs.size(); i ++) {
            if (used + costs.get(i) <= b) {
                used += costs.get(i);
                maxCuts ++;
            }
            else {
                break;
            }
        }
        System.out.println(maxCuts);
    }
}


import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int btcAmount = sc.nextInt();
        int[] btcCosts = new int[100];
        int even = 0, odd = 0;
        int right = 0;
        for (int i = 0; i < n; i++) {
            int left = 0;
            if (right == 0) {
                left = sc.nextInt();
            } else {
                left = right;
                right = 0;
            }
            if (left % 2 == 0) even++;
            else odd++;
            if (even == odd && i != n - 1) {
                right = sc.nextInt();
                int btcCost = Math.abs(left - right);
                btcCosts[btcCost] += 1;
                even = 0;
                odd = 0;
            }
        }
        int sawedAmount = 0;
        int currentBTCCost = 0;
        for (int i = 0; i < 100; i++) {
            for (int j = 0; j < btcCosts[i]; j++) {
                currentBTCCost += i;
                if (currentBTCCost <= btcAmount) {
                    sawedAmount++;
                } else break;
            }
        }
        System.out.println(sawedAmount);
    }
}


import java.util.* ;

public class Solution{

    public static void main(String[] args){

        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 c0 =0,c1 = 0;
        PriorityQueue<Integer> q = new PriorityQueue<Integer>() ;

        for(int i=0;i<n;i++){
            if(a[i] % 2 == 0){
                c0 ++ ;
            }else{
                c1 ++ ;
            }

            if(c0 == c1 && i < n-1){
                q.add( Math.abs(a[i+1] - a[i]) ) ;
            }

        }

         int cnt =0,sum = 0;

            while(!q.isEmpty() && sum + q.peek() <=  B){
                sum += q.poll() ;
                cnt++;
            }

            System.out.println(cnt) ;
    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.*;
import java.math.*;
public class q4 {

	int[] arr;
	int[] oc;
	int[] ec;
	int cut;
	int odd;
	int even;
	int bitcoin;
	q4(int[] a,int[] b,int[] c,int d,int e, int f){
		cut=0;
		arr=a;
		oc=b;
		ec=c;
		odd=d;
		even=e;
		bitcoin=f;
	}

	public static void main(String[] args) throws IOException{
		// TODO Auto-generated method stub
		 Reader.init(System.in);
		 int n=Reader.nextInt();
		 int b=Reader.nextInt();
		int[] arr=new int[n+1];
		int[] oddcount=new int[n+1];
		int[] evencount=new int[n+1];
		for(int i=1;i<=n;i++) {
			arr[i]=Reader.nextInt();
			if(arr[i]%2==1) {
				oddcount[i]=oddcount[i-1]+1;
				evencount[i]=evencount[i-1];
			}
			else {
				oddcount[i]=oddcount[i-1];
				evencount[i]=evencount[i-1]+1;
			}
		}
		int cut=0;
		int[] arr2=new int[n/2-1];
		for(int i=2;i<n;i+=2) {
			if(oddcount[i]==evencount[i]) {
				arr2[i/2-1]=Math.abs(arr[i]-arr[i+1]);
			}
			else {
				arr2[i/2-1]=-1;
			}
		}
		Arrays.sort(arr2);
		long sum=0;
		for(int i=0;i<n/2-1;i++) {
			if(arr2[i]!=-1 && sum+arr2[i]<=b) {
				cut++;
				sum+=arr2[i];
			}
		}
		System.out.println(cut);
}
}
class NN{
	int d1;
	int d2;
	NN(int a,int b){
		d1=a;
		d2=b;
	}
}
class SegmentTree{
	long[] segtree1;
	int[] arr;
	long[] segtree2;
	SegmentTree(int[] a,int n){
		arr=a;
		segtree1=new long[4*n];
		segtree2=new long[4*n];
	}
	void oddbuild(int low,int high,int pos) {
		if(low==high) {
			if(low%2==1)
			segtree1[pos]=arr[low];
		}
		else {
			int middle=(low+high)/2;
			oddbuild(low,middle,2*pos+1);
			oddbuild(middle+1,high,2*pos+2);
			segtree1[pos]=segtree1[2*pos+1]+segtree1[2*pos+2];
		}
	}

	void evenbuild(int low,int high,int pos) {
		if(low==high) {
			if(low%2==0)
			segtree2[pos]=arr[low];
		}
		else {
			int middle=(low+high)/2;
			evenbuild(low,middle,2*pos+1);
			evenbuild(middle+1,high,2*pos+2);
			segtree2[pos]=segtree2[2*pos+1]+segtree2[2*pos+2];
		}
	}
	/*int anss(int low,int high, int pos,int value) {
		if(low==high) {
			return low;
		}
		int middle=(low+high)/2;
		int left=segtree[2*pos+1];
		int right=segtree[2*pos+2];
		if(value<=left) {
			return anss(low,middle,2*pos+1,value);
		}
		else {
			return anss(middle+1,high,2*pos+2,value-left);
		}
	}*/
	long oddans(int low,int high,int pos,int ql,int qh) {
		if(ql<=low && qh>=high) {
			return segtree1[pos];
		}
		else if(ql>high || qh<low){
			return 0;
		}
		else {
			int middle=(low+high)/2;
			long left=oddans(low,middle,2*pos+1,ql,qh);
			long right=oddans(middle+1,high,2*pos+2,ql,qh);
			return left+right;
		}
	}
	long evenans(int low,int high,int pos,int ql,int qh) {
		if(ql<=low && qh>=high) {
			return segtree2[pos];
		}
		else if(ql>high || qh<low){
			return 0;
		}
		else {
			int middle=(low+high)/2;
			long left=evenans(low,middle,2*pos+1,ql,qh);
			long right=evenans(middle+1,high,2*pos+2,ql,qh);
			return left+right;
		}
	}
	/*void update(int pos,int low,int high,int elpos) {
		if(low==high) {
			segtree[pos]=arr[elpos];
		}
		else {
			int middle=(low+high)/2;
			if(elpos<=middle) {
				update(2*pos+1,low,middle,elpos);
			}
			else {
				update(2*pos+2,middle+1,high,elpos);
			}
			segtree[pos]=segtree[2*pos+1]+segtree[2*pos+2];
		}
	}*/
}

class N{
	int ans;
	int ob;
	int cb;
	int pos;
	boolean discard;
	N(int a,int b,int c,int d){
		ans=a;ob=b;cb=c;pos=d;
	}

}
class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                     new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */

    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                   reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }
    static long nextLong() throws IOException {
        return Long.parseLong( next() );
    }
    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }
}


import java.util.*;

public class acm1 {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n, b;
        n = sc.nextInt();
        b = sc.nextInt();
        ArrayList<Integer> cuts = new ArrayList<Integer>();
        int arr[];
        arr = new int[n];
        int even = 0, odd = 0;
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        for (int i = 0; i < n; i++) {
            if (i != 0 && even == odd) {
                cuts.add(Math.abs(arr[i] - arr[i - 1]));

            }
            if (arr[i] % 2 == 0) {
                even++;
            } else {
                odd++;
            }

        }
        Collections.sort(cuts);
        int count = 0;
        for (int i = 0; i < cuts.size(); i++) {

            if (cuts.get(i) <= b) {
                count++;
                b -= cuts.get(i);
            }
        }
        System.out.println(count);

    }

}


import java.io.*;
import java.util.*;
public class Cutting
{
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int b=sc.nextInt();
        int a[]=new int[n];
        for(int i=0;i<n;i++)
            a[i]=sc.nextInt();
        int count=0,sum=0,odd=0,even=0;
        List<Integer> al=new ArrayList();
        for(int i=0;i<n;i++)
        {
            if(a[i]%2!=0)
                odd++;
            else
                even++;
            if(i!=n-1)
            {
                if(odd==even)
                    al.add(Math.abs(a[i+1]-a[i]));
            }
        }
        Collections.sort(al);
        Integer c[]=new Integer[al.size()];
        c=al.toArray(c);
        for(int i=0;i<al.size();i++)
        {
            sum+=c[i];
            if(sum<=b)
                count++;
            else
                break;
        }
        System.out.println(count);
    }
}


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

/**
* @author soumitri12
*/

/* Name of the class has to be "Main" only if the class is public*/
public class CF998B
{
    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;
        }
    }

    static class Node {

        long pp;
        long a, b;

        Node(long x, long y) {
            a = x;
            b = y;
            pp = a * b;
        }
    }
    static class Comp implements Comparator<Node> {

        public int compare(Node o1, Node o2) {
            if (o1.pp > o2.pp) {
                return 1;
            } else {
                return -1;
            }
        }
    }
    static int gcd(int x, int y)
    {
        if(y==0) return x;
        else return gcd(y,x%y);
    }
    static long mod_pow(long a, long b, long mod)
    {
        a%=mod;
        if(b==0) return 1%mod;
        if((b&1)==1) return a*(mod_pow(a,b-1,mod))%mod;
        else
        {
            long u=mod_pow(a,b>>1,mod);
            return (u*u)%mod;
        }
    }
    static long _pow(long a, long b)
    {
        if(b==0) return 1;
        if((b&1)==1) return a*_pow(a,b-1);
        else
        {
            long u=_pow(a,b>>1);
            return u*u;
        }
    }
    static int modInv(int a, int m)
    {
        if(gcd(a,m)!=1) return -999;
        else return (a%m+m)%m;
    }
    static boolean isPowerOfTwo(int x)
    {
        return x!=0 && ((x&(x-1)) == 0);
    }
    static boolean isprime(int x)
    {
        for(int i=2;i<=Math.sqrt(x);i++)
        {
            if(x%i==0) return false;
        }
        return true;
    }
    static boolean prime[];
    static final int INT_MAX=1000007;

    static void sieve() {
        prime=new boolean[INT_MAX];
        Arrays.fill(prime,true);
        prime[0]=prime[1]=false;
        for(int i=2;i<=Math.sqrt(INT_MAX);i++)
        {
            if(prime[i]) {
                for(int j=i*2;j<INT_MAX;j+=i)
                prime[j]=false;
            }
        }
    }
    static class Pair {
        int ff,ss;
        public Pair(int ff,int ss) {
            this.ff=ff; this.ss=ss;
        }
    }

    public static void main(String[] args) {
        FastReader sc=new FastReader();
        PrintWriter out=new PrintWriter(System.out);
        StringBuffer sb=new StringBuffer();
        //your code starts here
        int n=sc.nextInt(),w=sc.nextInt();
        int a[]=new int[n];
        for(int i=0;i<n;i++) a[i]=sc.nextInt();
        int e=0,o=0;
        ArrayDeque<Integer> stack=new ArrayDeque<>();
        stack.push(a[0]);
        ArrayList<Integer> cuts=new ArrayList<>();
        /* for(int i=0;i<n-2;i++)
        {
            if(!stack.isEmpty()) {
                if((stack.peek()&1)==(a[i]&1)) stack.push(a[i]);
                else {
                    cuts.add(Math.abs(a[i+1]-a[i])); stack.pop();
                }
            } else stack.push(a[i]);
        } */

        for(int i=0;i<n-1;i++)
        {
            if((a[i]&1)==0)++e;
            else ++o;
            if(e==o) cuts.add(Math.abs(a[i]-a[i+1]));
        }

        n=cuts.size();

        int dp[][]=new int[n+1][w+1];
        for(int i=0;i<=n;i++) {
            for(int j=0;j<=w;j++) {
                if(i*j==0) dp[i][j]=0;
            }
        }
        for(int i=1;i<=n;i++) {
            for(int j=1;j<=w;j++) {
                if(cuts.get(i-1)<=j) {
                    dp[i][j]=Math.max(1+dp[i-1][j-cuts.get(i-1)],dp[i-1][j]);
                } else dp[i][j]=dp[i-1][j];
            }
        }
        int ans=dp[n][w];
        out.println(ans);

        out.close();
    }
}