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