#include <bits/stdc++.h>
using namespace std;
const int NMAX = 1e5 + 7, oo = 1e9;
int n, b, a[105], dp[101][101][101], p[101];
bool odd(int x) { return x % 2; }
bool ok(int l, int r) { return !(p[r] - p[l - 1]); }
int solve(int idx, int lastidx, int money) {
  if (money < 0) return -oo;
  if (idx > n) {
    if (ok(lastidx, n)) return 0;
    return -oo;
  }
  int& ret = dp[idx][lastidx][money];
  if (ret != -1) return ret;
  ret = 0;
  if (ok(lastidx, idx - 1))
    ret = solve(idx + 1, idx, money - abs(a[idx] - a[idx - 1])) + 1;
  ret = max(ret, solve(idx + 1, lastidx, money));
  return ret;
}
int main() {
  cin >> n >> b;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    p[i] = (a[i] % 2) ? 1 : -1;
  }
  for (int i = 1; i <= n; i++) {
    p[i] += p[i - 1];
  }
  a[0] = oo;
  a[n + 1] = oo;
  memset(dp, -1, sizeof dp);
  std::cout << solve(2, 1, b) << '\n';
}
