#include <bits/stdc++.h>
using namespace std;
int n, k, a[2005], cnt;
void work() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int i = 1; i <= n; ++i)
    if (a[i] + k <= 5) ++cnt;
  printf("%d\n", cnt / 3);
}
int main() {
  work();
  return 0;
}
