#include <bits/stdc++.h>
using namespace std;
const int MN = 2000;
int N, K, Y[MN];
int main() {
  scanf("%d %d", &N, &K);
  for (int i = 0; i < N; i++) {
    scanf("%d", &Y[i]);
  }
  sort(Y, Y + N);
  int c = 0;
  for (int i = 0; i < N; i += 3) {
    if (N < i + 3) {
      break;
    }
    for (int ii = i; ii < i + 3; ii++) {
      if (5 < Y[ii] + K) {
        goto L1;
      }
    }
    c++;
  }
L1:;
  printf("%d\n", c);
  return 0;
}
