#include <bits/stdc++.h>
int main() {
  int n, k;
  int i, j;
  int team[2002];
  int count = 0;
  scanf("%d%d", &n, &k);
  for (i = 0; i < n; i++) {
    scanf("%d", &team[i]);
    if (team[i] + k <= 5) count++;
  }
  printf("%d\n", count / 3);
  return 0;
}
