#include <bits/stdc++.h>
using namespace std;
const int INF = 2000000000;
const int MOD = 1000000007;
const int NMAX = 40005;
const int MMAX = 40005;
int main() {
  int n, k, a, y = 0;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a);
    if (5 - a >= k) {
      y++;
    }
  }
  printf("%d\n", y / 3);
  return 0;
}
