#include <bits/stdc++.h>
using namespace std;
const int N = 100 + 5;
int n, m, a[N], f[N][N];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = (1); i <= (int)(n); ++i) scanf("%d", &a[i]);
  memset(f, -1, sizeof f);
  f[0][0] = 0;
  a[n + 1] = a[n];
  for (int i = (0); i <= (int)(n - 1); ++i)
    for (int j = (0); j <= (int)(m); ++j)
      if (f[i][j] > -1) {
        int odd = 0, even = 0;
        for (int k = (i + 1); k <= (int)(n); ++k) {
          if (a[k] & 1)
            ++odd;
          else
            ++even;
          if (odd ^ even) continue;
          int nj = j + abs(a[k] - a[k + 1]);
          if (nj <= m) {
            if (k < n)
              f[k][nj] = max(f[k][nj], f[i][j] + 1);
            else
              f[k][nj] = max(f[k][nj], f[i][j]);
          }
        }
      }
  int mx = 0;
  for (int j = (0); j <= (int)(m); ++j) mx = max(mx, f[n][j]);
  printf("%d\n", mx);
  return 0;
}
