#include <bits/stdc++.h>
using namespace std;
int n, k, a[100];
int dp[101][101];
int solve(int i, int x, int k) {
  if (i == n && x == 0) return 0;
  if (i == n && x != 0) return -1e9;
  if (dp[i][k] != -1) return dp[i][k];
  int y = (a[i + 1] % 2 == 0);
  if (!y) y = -1;
  int r = abs(a[i + 1] - a[i]);
  int aa = 0;
  if (!x && k >= r) {
    aa = max(aa, max(1 + solve(i + 1, y, k - r), solve(i + 1, x + y, k)));
  } else {
    aa = max(aa, solve(i + 1, x + y, k));
  }
  return dp[i][k] = aa;
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  memset(dp, -1, sizeof dp);
  int x = (a[0] % 2 == 0) ? 1 : -1;
  cout << solve(0, x, k);
  return 0;
}
