#include <bits/stdc++.h>
using namespace std;
const int MaxN = 1e6 + 17;
int d[110][110];
int n, k, a[MaxN];
int Rec(int pos, int kol) {
  if (pos > n) {
    return 0;
  }
  if (kol < 0) return 0;
  if (d[pos][kol] != -1) return d[pos][kol];
  int x = 0;
  int ans = 0;
  for (int i = pos; i <= n; ++i) {
    if (a[i] % 2 == 1)
      ++x;
    else
      --x;
    if (x == 0) {
      ans = max(ans, Rec(i + 1, kol - abs(a[i] - a[i + 1])) + 1);
    }
  }
  d[pos][kol] = ans;
  return ans;
}
int main() {
  memset(d, -1, sizeof(d));
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  cout << Rec(1, k) - 1;
  return 0;
}
