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